summaryrefslogtreecommitdiff
path: root/src/gui/curses
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-05-12 23:06:39 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-03-26 15:52:19 +0200
commit9ac30381faf07f298e88ee777cbc6748b68a5cab (patch)
tree342c6b2b1f11b4c56a35ecd34c48d55fab83d0b6 /src/gui/curses
parent20cea84917804baa379902e757cd1d71cc05d1a1 (diff)
downloadweechat-9ac30381faf07f298e88ee777cbc6748b68a5cab.zip
core: Implement commands for operating on a single input line
This changes the commands delete_beginning_of_line, delete_end_of_line, delete_line, move_beginning_of_line and move_end_of_line to operate on the current line instead of the whole input. The commands delete_beginning_of_input, delete_end_of_input, delete_input, move_beginning_of_input and move_end_of_input are added with the previous implementations that the line commands had. Additionally, the commands move_previous_line and move_next_line are added which moves the cursor to the previous/next line and keeps the horizontal position in the line. The meta-r key is changed from delete_line to delete_input to keep the behavior, and because you probably want to delete the whole input more often than the line. The meta-R key is added for delete_line. The home, end, ctrl-u and ctrl-k keys are kept to the same commands, which means that they change behaviour. This is because having them operate on the line is consistent with other applications (vim, zsh), and I also think it's more practical. These new bindings are added: shift-home: /input move_beginning_of_input shift-end: /input move_end_of_input shift-up: /input move_previous_line shift-down: /input move_next_line meta-R: /input delete_line meta-ctrl-u: /input delete_beginning_of_input meta-ctrl-k: /input delete_end_of_input Relates to #1498
Diffstat (limited to 'src/gui/curses')
-rw-r--r--src/gui/curses/gui-curses-key.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/curses/gui-curses-key.c b/src/gui/curses/gui-curses-key.c
index 4fb0f6fc3..cf0c9c57f 100644
--- a/src/gui/curses/gui-curses-key.c
+++ b/src/gui/curses/gui-curses-key.c
@@ -95,14 +95,19 @@ gui_key_default_bindings (int context, int create_option)
BIND("meta-x", "/buffer zoom");
BIND("meta-d", "/input delete_next_word");
BIND("ctrl-k", "/input delete_end_of_line");
- BIND("meta-r", "/input delete_line");
+ BIND("meta-ctrl-k", "/input delete_end_of_input");
+ BIND("meta-r", "/input delete_input");
+ BIND("meta-R", "/input delete_line");
BIND("ctrl-t", "/input transpose_chars");
BIND("ctrl-u", "/input delete_beginning_of_line");
+ BIND("meta-ctrl-u", "/input delete_beginning_of_input");
BIND("ctrl-y", "/input clipboard_paste");
BIND("home", "/input move_beginning_of_line");
BIND("ctrl-a", "/input move_beginning_of_line");
+ BIND("shift-home", "/input move_beginning_of_input");
BIND("end", "/input move_end_of_line");
BIND("ctrl-e", "/input move_end_of_line");
+ BIND("shift-end", "/input move_end_of_input");
BIND("left", "/input move_previous_char");
BIND("ctrl-b", "/input move_previous_char");
BIND("right", "/input move_next_char");
@@ -115,6 +120,8 @@ gui_key_default_bindings (int context, int create_option)
BIND("down", "/input history_next");
BIND("ctrl-up", "/input history_global_previous");
BIND("ctrl-down", "/input history_global_next");
+ BIND("shift-up", "/input move_previous_line");
+ BIND("shift-down", "/input move_next_line");
BIND("meta-a", "/buffer jump smart");
BIND("meta-j,meta-f", "/buffer -");
BIND("meta-j,meta-l", "/buffer +");