From 3c95f6aae9826c10a50c4a0f12c16fca6038410c Mon Sep 17 00:00:00 2001 From: "Todd A. Pratt" Date: Mon, 2 Nov 2015 08:00:52 -0500 Subject: Make C-w and M-backspace work right. --- src/fe-text/gui-readline.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/fe-text/gui-readline.c') diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c index ec61e317..4d645748 100644 --- a/src/fe-text/gui-readline.c +++ b/src/fe-text/gui-readline.c @@ -68,6 +68,8 @@ static int paste_timeout_id; static void sig_input(void); +static int key_repeated = FALSE; + void input_listen_init(int handle) { readtag = g_input_add_poll(handle, @@ -361,6 +363,7 @@ static void sig_gui_key_pressed(gpointer keyp) int ret; key = GPOINTER_TO_INT(keyp); + key_repeated = key == prev_key; if (redir != NULL && redir->flags & ENTRY_REDIRECT_FLAG_HOTKEY) { handle_key_redirect(key); @@ -596,7 +599,7 @@ static void key_backspace(void) static void key_delete_previous_word(void) { - gui_entry_erase_word(active_entry, FALSE); + gui_entry_erase_word(active_entry, FALSE, key_repeated); } static void key_delete_next_word(void) @@ -606,7 +609,7 @@ static void key_delete_next_word(void) static void key_delete_to_previous_space(void) { - gui_entry_erase_word(active_entry, TRUE); + gui_entry_erase_word(active_entry, TRUE, key_repeated); } static void key_delete_to_next_space(void) -- cgit v1.2.3 From 1199ecc62f137eedb388b3dbd9b003cf1a8280f7 Mon Sep 17 00:00:00 2001 From: "Todd A. Pratt" Date: Fri, 13 Nov 2015 13:42:28 -0500 Subject: a facility for prepending or replacing the cutbuffer --- src/fe-text/gui-readline.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/fe-text/gui-readline.c') diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c index c21925db..47689b4d 100644 --- a/src/fe-text/gui-readline.c +++ b/src/fe-text/gui-readline.c @@ -530,7 +530,7 @@ static void key_forward_to_space(void) static void key_erase_line(void) { gui_entry_set_pos(active_entry, active_entry->text_len); - gui_entry_erase(active_entry, active_entry->text_len, TRUE); + gui_entry_erase(active_entry, active_entry->text_len, CUTBUFFER_UPDATE_REPLACE); } static void key_erase_to_beg_of_line(void) @@ -538,7 +538,7 @@ static void key_erase_to_beg_of_line(void) int pos; pos = gui_entry_get_pos(active_entry); - gui_entry_erase(active_entry, pos, TRUE); + gui_entry_erase(active_entry, pos, CUTBUFFER_UPDATE_REPLACE); } static void key_erase_to_end_of_line(void) @@ -547,7 +547,7 @@ static void key_erase_to_end_of_line(void) pos = gui_entry_get_pos(active_entry); gui_entry_set_pos(active_entry, active_entry->text_len); - gui_entry_erase(active_entry, active_entry->text_len - pos, TRUE); + gui_entry_erase(active_entry, active_entry->text_len - pos, CUTBUFFER_UPDATE_REPLACE); } static void key_yank_from_cutbuffer(void) @@ -594,12 +594,12 @@ static void key_delete_character(void) static void key_backspace(void) { - gui_entry_erase(active_entry, 1, FALSE); + gui_entry_erase(active_entry, 1, CUTBUFFER_UPDATE_NOOP); } static void key_delete_previous_word(void) { - gui_entry_erase_word(active_entry, FALSE, key_repeated); + gui_entry_erase_word(active_entry, FALSE, CUTBUFFER_UPDATE_REPLACE); } static void key_delete_next_word(void) @@ -609,7 +609,7 @@ static void key_delete_next_word(void) static void key_delete_to_previous_space(void) { - gui_entry_erase_word(active_entry, TRUE, key_repeated); + gui_entry_erase_word(active_entry, TRUE, CUTBUFFER_UPDATE_REPLACE); } static void key_delete_to_next_space(void) -- cgit v1.2.3 From f90e10c5d27ee7d8a6663a432238cf487e7d372f Mon Sep 17 00:00:00 2001 From: "Todd A. Pratt" Date: Fri, 13 Nov 2015 14:01:25 -0500 Subject: remove more cruft from previous implementation --- src/fe-text/gui-readline.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/fe-text/gui-readline.c') diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c index 47689b4d..0ca68d80 100644 --- a/src/fe-text/gui-readline.c +++ b/src/fe-text/gui-readline.c @@ -68,8 +68,6 @@ static int paste_timeout_id; static void sig_input(void); -static int key_repeated = FALSE; - void input_listen_init(int handle) { readtag = g_input_add_poll(handle, @@ -363,7 +361,6 @@ static void sig_gui_key_pressed(gpointer keyp) int ret; key = GPOINTER_TO_INT(keyp); - key_repeated = key == prev_key; if (redir != NULL && redir->flags & ENTRY_REDIRECT_FLAG_HOTKEY) { handle_key_redirect(key); -- cgit v1.2.3