summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.adoc1
-rw-r--r--src/gui/gui-input.c22
2 files changed, 12 insertions, 11 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 6caa555fb..0c82b7b36 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -34,6 +34,7 @@ New features::
Bug fixes::
+ * core: fix delete of previous/next word (keys kbd:[Ctrl+w] and kbd:[Alt+d]) (issue #1195)
* core: fix infinite loop in evaluation of strings (issue #1183)
* core: change default value of option weechat.look.window_title from "WeeChat ${info:version}" to empty string (issue #1182)
* irc: always set nick away status on WHO response (sent manually or automatically with server option "away_check")
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index c9d7d695d..b083637ab 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -851,27 +851,22 @@ gui_input_delete_previous_word (struct t_gui_buffer *buffer)
start = (char *)utf8_add_offset (buffer->input_buffer,
buffer->input_buffer_pos - 1);
string = start;
+ /* move to the left until we reach a word char */
while (string && !string_is_word_char_input (string))
{
string = (char *)utf8_prev_char (buffer->input_buffer, string);
}
+ /* move to the left to skip the whole word */
if (string)
{
while (string && string_is_word_char_input (string))
{
string = (char *)utf8_prev_char (buffer->input_buffer, string);
}
- if (string)
- {
- while (string && !string_is_word_char_input (string))
- {
- string = (char *)utf8_prev_char (buffer->input_buffer, string);
- }
- }
}
if (string)
- string = (char *)utf8_next_char (utf8_next_char (string));
+ string = (char *)utf8_next_char (string);
else
string = buffer->input_buffer;
@@ -913,10 +908,15 @@ gui_input_delete_next_word (struct t_gui_buffer *buffer)
buffer->input_buffer_pos);
string = start;
length_deleted = 0;
- while (string[0])
+ /* move to the right until we reach a word char */
+ while (string[0] && !string_is_word_char_input (string))
+ {
+ string = (char *)utf8_next_char (string);
+ length_deleted++;
+ }
+ /* move to the right to skip the whole word */
+ while (string[0] && string_is_word_char_input (string))
{
- if (!string_is_word_char_input (string) && (string > start))
- break;
string = (char *)utf8_next_char (string);
length_deleted++;
}