From ff9b0f5ccd695395f4b7a18ab81426aa54b1b66f Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Wed, 13 Jun 2018 14:15:31 +0200 Subject: [PATCH] Add default shortcuts: Shift+BackSpace to delete previous char, Ctrl+Left/Right for word movements (#790) * Support Shift+BackSpace by default to delete previous char * Support Ctrl+Arrow for word movements --- README.md | 70 ++++++++++++++++++++-------------------- doc/rofi.1 | 6 ++-- doc/rofi.1.markdown | 6 ++-- doc/test_xr.txt | 6 ++-- source/keyb.c | 6 ++-- source/widgets/textbox.c | 6 ++-- 6 files changed, 50 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index a80e71fa..f22910a2 100644 --- a/README.md +++ b/README.md @@ -160,41 +160,41 @@ Type `Shift-/Left/Right` to switch between active modi. ## Key bindings -| Key | Action | -|:----------------------------|:-------------------------------------------------------------------| -|`Ctrl-v, Insert` | Paste from clipboard | -|`Ctrl-Shift-v, Shift-Insert` | Paste primary selection | -|`Ctrl-w` | Clear the line | -|`Ctrl-u` | Delete till the start of line | -|`Ctrl-a` | Move to beginning of line | -|`Ctrl-e` | Move to end of line | -|`Ctrl-f, Right` | Move forward one character | -|`Alt-f` | Move forward one word | -|`Ctrl-b, Left` | Move back one character | -|`Alt-b` | Move back one word | -|`Ctrl-d, Delete` | Delete character | -|`Ctrl-Alt-d` | Delete word | -|`Ctrl-h, Backspace` | Backspace (delete previous character) | -|`Ctrl-Alt-h` | Delete previous word | -|`Ctrl-j,Ctrl-m,Enter` | Accept entry | -|`Ctrl-n,Down` | Select next entry | -|`Ctrl-p,Up` | Select previous entry | -|`Page Up` | Go to the previous page | -|`Page Down` | Go to the next page | -|`Ctrl-Page Up` | Go to the previous column | -|`Ctrl-Page Down` | Go to the next column | -|`Ctrl-Enter` | Use entered text as a command (in `ssh/run modi`) | -|`Shift-Enter` | Launch the application in a terminal (in run mode) | -|`Shift-Enter` | Return the selected entry and move to the next item while keeping Rofi open. (in dmenu) | -|`Shift-Right` | Switch to the next modi. The list can be customized with the -modi option. | -|`Shift-Left` | Switch to the previous modi. The list can be customized with the -modi option. | -|`Ctrl-Tab` | Switch to the next modi. The list can be customized with the -modi option. | -|`Ctrl-Shift-Tab` | Switch to the previous modi. The list can be customized with the -modi option. | -|`Ctrl-space` | Set selected item as input text. | -|`Shift-Del` | Delete entry from history. | -|`grave` | Toggle case sensitivity. | -|`Alt-grave` | Toggle levenshtein sort. | -|`Alt-Shift-S` | Take a screenshot and store it in the Pictures directory. | +| Key | Action | +|:-------------------------------------|:-------------------------------------------------------------------| +|`Ctrl-v, Insert` | Paste from clipboard | +|`Ctrl-Shift-v, Shift-Insert` | Paste primary selection | +|`Ctrl-w` | Clear the line | +|`Ctrl-u` | Delete till the start of line | +|`Ctrl-a` | Move to beginning of line | +|`Ctrl-e` | Move to end of line | +|`Ctrl-f, Right` | Move forward one character | +|`Alt-f, Ctrl-Right` | Move forward one word | +|`Ctrl-b, Left` | Move back one character | +|`Alt-b, Ctrl-Left` | Move back one word | +|`Ctrl-d, Delete` | Delete character | +|`Ctrl-Alt-d` | Delete word | +|`Ctrl-h, Backspace, Shift-Backspace` | Backspace (delete previous character) | +|`Ctrl-Alt-h` | Delete previous word | +|`Ctrl-j,Ctrl-m,Enter` | Accept entry | +|`Ctrl-n,Down` | Select next entry | +|`Ctrl-p,Up` | Select previous entry | +|`Page Up` | Go to the previous page | +|`Page Down` | Go to the next page | +|`Ctrl-Page Up` | Go to the previous column | +|`Ctrl-Page Down` | Go to the next column | +|`Ctrl-Enter` | Use entered text as a command (in `ssh/run modi`) | +|`Shift-Enter` | Launch the application in a terminal (in run mode) | +|`Shift-Enter` | Return the selected entry and move to the next item while keeping Rofi open. (in dmenu) | +|`Shift-Right` | Switch to the next modi. The list can be customized with the -modi option. | +|`Shift-Left` | Switch to the previous modi. The list can be customized with the -modi option. | +|`Ctrl-Tab` | Switch to the next modi. The list can be customized with the -modi option. | +|`Ctrl-Shift-Tab` | Switch to the previous modi. The list can be customized with the -modi option. | +|`Ctrl-space` | Set selected item as input text. | +|`Shift-Del` | Delete entry from history. | +|`grave` | Toggle case sensitivity. | +|`Alt-grave` | Toggle levenshtein sort. | +|`Alt-Shift-S` | Take a screenshot and store it in the Pictures directory. | For the full list of key bindings, see: `rofi -show keys` or `rofi -help`. diff --git a/doc/rofi.1 b/doc/rofi.1 index f88c98aa..d422355b 100644 --- a/doc/rofi.1 +++ b/doc/rofi.1 @@ -1278,13 +1278,13 @@ Transparency can be used within \fBrofi\fR, for example if the selected backgrou \fBCtrl\-f, Right\fR: Forward one character . .IP "\(bu" 4 -\fBAlt\-f\fR: Forward one word +\fBAlt\-f, Ctrl\-Right\fR: Forward one word . .IP "\(bu" 4 \fBCtrl\-b, Left\fR: Back one character . .IP "\(bu" 4 -\fBAlt\-b\fR: Back one word +\fBAlt\-b, Ctrl\-Left\fR: Back one word . .IP "\(bu" 4 \fBCtrl\-d, Delete\fR: Delete character @@ -1293,7 +1293,7 @@ Transparency can be used within \fBrofi\fR, for example if the selected backgrou \fBCtrl\-Alt\-d\fR: Delete word . .IP "\(bu" 4 -\fBCtrl\-h, Backspace\fR: Backspace (delete previous character) +\fBCtrl\-h, Backspace, Shift\-Backspace\fR: Backspace (delete previous character) . .IP "\(bu" 4 \fBCtrl\-Alt\-h\fR: Delete previous word diff --git a/doc/rofi.1.markdown b/doc/rofi.1.markdown index 7fa5574e..a3ae4877 100644 --- a/doc/rofi.1.markdown +++ b/doc/rofi.1.markdown @@ -766,12 +766,12 @@ of the window will be visible through it. * `Ctrl-a`: Beginning of line * `Ctrl-e`: End of line * `Ctrl-f, Right`: Forward one character - * `Alt-f`: Forward one word + * `Alt-f, Ctrl-Right`: Forward one word * `Ctrl-b, Left`: Back one character - * `Alt-b`: Back one word + * `Alt-b, Ctrl-Left`: Back one word * `Ctrl-d, Delete`: Delete character * `Ctrl-Alt-d`: Delete word - * `Ctrl-h, Backspace`: Backspace (delete previous character) + * `Ctrl-h, Backspace, Shift-Backspace`: Backspace (delete previous character) * `Ctrl-Alt-h`: Delete previous word * `Ctrl-j,Ctrl-m,Enter`: Accept entry * `Ctrl-n,Down`: Select next entry diff --git a/doc/test_xr.txt b/doc/test_xr.txt index 2b3bd585..fe2ea9aa 100644 --- a/doc/test_xr.txt +++ b/doc/test_xr.txt @@ -127,9 +127,9 @@ rofi.kb-move-front: Control+a ! "End of line" Set from: File rofi.kb-move-end: Control+e ! "Move back one word" Set from: File -rofi.kb-move-word-back: Alt+b +rofi.kb-move-word-back: Alt+b,Ctrl+Left ! "Move forward one word" Set from: File -rofi.kb-move-word-forward: Alt+f +rofi.kb-move-word-forward: Alt+f,Ctrl+Right ! "Move back one char" Set from: File rofi.kb-move-char-back: Left,Control+b ! "Move forward one char" Set from: File @@ -141,7 +141,7 @@ rofi.kb-remove-word-forward: Control+Alt+d ! "Delete next char" Set from: File rofi.kb-remove-char-forward: Delete,Control+d ! "Delete previous char" Set from: File -rofi.kb-remove-char-back: BackSpace,Control+h +rofi.kb-remove-char-back: BackSpace,Shift+BackSpace,Control+h ! "Delete till the end of line" Set from: File rofi.kb-remove-to-eol: Control+k ! "Delete till the start of line" Set from: File diff --git a/source/keyb.c b/source/keyb.c index 3f6b85aa..e230984e 100644 --- a/source/keyb.c +++ b/source/keyb.c @@ -50,14 +50,14 @@ ActionBindingEntry rofi_bindings[] = { .id = CLEAR_LINE, .name = "kb-clear-line", .binding = "Control+w", .comment = "Clear input line" }, { .id = MOVE_FRONT, .name = "kb-move-front", .binding = "Control+a", .comment = "Beginning of line" }, { .id = MOVE_END, .name = "kb-move-end", .binding = "Control+e", .comment = "End of line" }, - { .id = MOVE_WORD_BACK, .name = "kb-move-word-back", .binding = "Alt+b", .comment = "Move back one word" }, - { .id = MOVE_WORD_FORWARD, .name = "kb-move-word-forward", .binding = "Alt+f", .comment = "Move forward one word" }, + { .id = MOVE_WORD_BACK, .name = "kb-move-word-back", .binding = "Alt+b,Control+Left", .comment = "Move back one word" }, + { .id = MOVE_WORD_FORWARD, .name = "kb-move-word-forward", .binding = "Alt+f,Control+Right", .comment = "Move forward one word" }, { .id = MOVE_CHAR_BACK, .name = "kb-move-char-back", .binding = "Left,Control+b", .comment = "Move back one char" }, { .id = MOVE_CHAR_FORWARD, .name = "kb-move-char-forward", .binding = "Right,Control+f", .comment = "Move forward one char" }, { .id = REMOVE_WORD_BACK, .name = "kb-remove-word-back", .binding = "Control+Alt+h,Control+BackSpace", .comment = "Delete previous word" }, { .id = REMOVE_WORD_FORWARD, .name = "kb-remove-word-forward", .binding = "Control+Alt+d", .comment = "Delete next word" }, { .id = REMOVE_CHAR_FORWARD, .name = "kb-remove-char-forward", .binding = "Delete,Control+d", .comment = "Delete next char" }, - { .id = REMOVE_CHAR_BACK, .name = "kb-remove-char-back", .binding = "BackSpace,Control+h", .comment = "Delete previous char" }, + { .id = REMOVE_CHAR_BACK, .name = "kb-remove-char-back", .binding = "BackSpace,Shift+BackSpace,Control+h", .comment = "Delete previous char" }, { .id = REMOVE_TO_EOL, .name = "kb-remove-to-eol", .binding = "Control+k", .comment = "Delete till the end of line" }, { .id = REMOVE_TO_SOL, .name = "kb-remove-to-sol", .binding = "Control+u", .comment = "Delete till the start of line" }, { .id = ACCEPT_ENTRY, .name = "kb-accept-entry", .binding = "Control+j,Control+m,Return,KP_Enter", .comment = "Accept entry" }, diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index 644ef31d..3548a95c 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -778,15 +778,15 @@ int textbox_keybinding ( textbox *tb, KeyBindingAction action ) case REMOVE_CHAR_FORWARD: textbox_cursor_del ( tb ); return 1; - // Alt-B + // Alt-B, Ctrl-Left case MOVE_WORD_BACK: textbox_cursor_dec_word ( tb ); return 2; - // Alt-F + // Alt-F, Ctrl-Right case MOVE_WORD_FORWARD: textbox_cursor_inc_word ( tb ); return 2; - // BackSpace, Ctrl-h + // BackSpace, Shift-BackSpace, Ctrl-h case REMOVE_CHAR_BACK: textbox_cursor_bkspc ( tb ); return 1;