Keyboard Layout support #102

Merged
MartinFouilleul merged 3 commits from keyboard_layout into main 2023-09-13 14:36:54 +00:00
1 changed files with 60 additions and 4 deletions
Showing only changes of commit a1ffcd3ddc - Show all commits

View File

@ -2778,15 +2778,29 @@ const oc_ui_edit_command OC_UI_EDIT_COMMANDS_MACOS[] = {
.direction = 1 }, .direction = 1 },
//NOTE(martin): move start //NOTE(martin): move start
{ {
.key = OC_KEY_Q, .key = OC_KEY_A,
.mods = OC_KEYMOD_CTRL, .mods = OC_KEYMOD_CTRL,
.operation = OC_UI_EDIT_MOVE, .operation = OC_UI_EDIT_MOVE,
.move = OC_UI_EDIT_MOVE_LINE, .move = OC_UI_EDIT_MOVE_LINE,
.direction = -1 }, .direction = -1 },
{ .key = OC_KEY_UP, { .key = OC_KEY_UP,
.operation = OC_UI_EDIT_MOVE, .operation = OC_UI_EDIT_MOVE,
.move = OC_UI_EDIT_MOVE_LINE, .move = OC_UI_EDIT_MOVE_LINE,
.direction = -1 }, .direction = -1 },
{ .key = OC_KEY_UP,
.mods = OC_KEYMOD_CMD,
.operation = OC_UI_EDIT_MOVE,
.move = OC_UI_EDIT_MOVE_LINE,
.direction = -1 },
{ .key = OC_KEY_LEFT,
.mods = OC_KEYMOD_CMD,
.operation = OC_UI_EDIT_MOVE,
.move = OC_UI_EDIT_MOVE_LINE,
.direction = -1 },
//NOTE(martin): move end //NOTE(martin): move end
{ {
.key = OC_KEY_E, .key = OC_KEY_E,
@ -2794,10 +2808,24 @@ const oc_ui_edit_command OC_UI_EDIT_COMMANDS_MACOS[] = {
.operation = OC_UI_EDIT_MOVE, .operation = OC_UI_EDIT_MOVE,
.move = OC_UI_EDIT_MOVE_LINE, .move = OC_UI_EDIT_MOVE_LINE,
.direction = 1 }, .direction = 1 },
{ .key = OC_KEY_DOWN, { .key = OC_KEY_DOWN,
.operation = OC_UI_EDIT_MOVE, .operation = OC_UI_EDIT_MOVE,
.move = OC_UI_EDIT_MOVE_LINE, .move = OC_UI_EDIT_MOVE_LINE,
.direction = 1 }, .direction = 1 },
{ .key = OC_KEY_DOWN,
.mods = OC_KEYMOD_CMD,
.operation = OC_UI_EDIT_MOVE,
.move = OC_UI_EDIT_MOVE_LINE,
.direction = 1 },
{ .key = OC_KEY_RIGHT,
.mods = OC_KEYMOD_CMD,
.operation = OC_UI_EDIT_MOVE,
.move = OC_UI_EDIT_MOVE_LINE,
.direction = 1 },
//NOTE(martin): select one left //NOTE(martin): select one left
{ {
.key = OC_KEY_LEFT, .key = OC_KEY_LEFT,
@ -2828,16 +2856,29 @@ const oc_ui_edit_command OC_UI_EDIT_COMMANDS_MACOS[] = {
.direction = 1 }, .direction = 1 },
//NOTE(martin): extend select to start //NOTE(martin): extend select to start
{ {
.key = OC_KEY_Q, .key = OC_KEY_A,
.mods = OC_KEYMOD_CTRL | OC_KEYMOD_SHIFT, .mods = OC_KEYMOD_CTRL | OC_KEYMOD_SHIFT,
.operation = OC_UI_EDIT_SELECT_EXTEND, .operation = OC_UI_EDIT_SELECT_EXTEND,
.move = OC_UI_EDIT_MOVE_LINE, .move = OC_UI_EDIT_MOVE_LINE,
.direction = -1 }, .direction = -1 },
{ .key = OC_KEY_UP, { .key = OC_KEY_UP,
.mods = OC_KEYMOD_SHIFT, .mods = OC_KEYMOD_SHIFT,
.operation = OC_UI_EDIT_SELECT_EXTEND, .operation = OC_UI_EDIT_SELECT_EXTEND,
.move = OC_UI_EDIT_MOVE_LINE, .move = OC_UI_EDIT_MOVE_LINE,
.direction = -1 }, .direction = -1 },
{ .key = OC_KEY_UP,
.mods = OC_KEYMOD_CMD | OC_KEYMOD_SHIFT,
.operation = OC_UI_EDIT_SELECT_EXTEND,
.move = OC_UI_EDIT_MOVE_LINE,
.direction = -1 },
{ .key = OC_KEY_LEFT,
.mods = OC_KEYMOD_CMD | OC_KEYMOD_SHIFT,
.operation = OC_UI_EDIT_SELECT_EXTEND,
.move = OC_UI_EDIT_MOVE_LINE,
.direction = -1 },
//NOTE(martin): extend select to end //NOTE(martin): extend select to end
{ {
.key = OC_KEY_E, .key = OC_KEY_E,
@ -2845,14 +2886,28 @@ const oc_ui_edit_command OC_UI_EDIT_COMMANDS_MACOS[] = {
.operation = OC_UI_EDIT_SELECT_EXTEND, .operation = OC_UI_EDIT_SELECT_EXTEND,
.move = OC_UI_EDIT_MOVE_LINE, .move = OC_UI_EDIT_MOVE_LINE,
.direction = 1 }, .direction = 1 },
{ .key = OC_KEY_DOWN, { .key = OC_KEY_DOWN,
.mods = OC_KEYMOD_SHIFT, .mods = OC_KEYMOD_SHIFT,
.operation = OC_UI_EDIT_SELECT_EXTEND, .operation = OC_UI_EDIT_SELECT_EXTEND,
.move = OC_UI_EDIT_MOVE_LINE, .move = OC_UI_EDIT_MOVE_LINE,
.direction = 1 }, .direction = 1 },
{ .key = OC_KEY_DOWN,
.mods = OC_KEYMOD_CMD | OC_KEYMOD_SHIFT,
.operation = OC_UI_EDIT_SELECT_EXTEND,
.move = OC_UI_EDIT_MOVE_LINE,
.direction = 1 },
{ .key = OC_KEY_RIGHT,
.mods = OC_KEYMOD_CMD | OC_KEYMOD_SHIFT,
.operation = OC_UI_EDIT_SELECT_EXTEND,
.move = OC_UI_EDIT_MOVE_LINE,
.direction = 1 },
//NOTE(martin): select all //NOTE(martin): select all
{ {
.key = OC_KEY_Q, .key = OC_KEY_A,
.mods = OC_KEYMOD_CMD, .mods = OC_KEYMOD_CMD,
.operation = OC_UI_EDIT_SELECT_ALL, .operation = OC_UI_EDIT_SELECT_ALL,
.move = OC_UI_EDIT_MOVE_NONE }, .move = OC_UI_EDIT_MOVE_NONE },
@ -2945,6 +3000,7 @@ const oc_ui_edit_command OC_UI_EDIT_COMMANDS_WINDOWS[] = {
.operation = OC_UI_EDIT_MOVE, .operation = OC_UI_EDIT_MOVE,
.move = OC_UI_EDIT_MOVE_LINE, .move = OC_UI_EDIT_MOVE_LINE,
.direction = 1 }, .direction = 1 },
{ .key = OC_KEY_DOWN, { .key = OC_KEY_DOWN,
.operation = OC_UI_EDIT_MOVE, .operation = OC_UI_EDIT_MOVE,
.move = OC_UI_EDIT_MOVE_LINE, .move = OC_UI_EDIT_MOVE_LINE,