From 90c2b0a565c4be0f3d597552441572e0bdf4c52b Mon Sep 17 00:00:00 2001 From: Michael Elkins Date: Mon, 28 Nov 2011 09:46:46 -0800 Subject: [PATCH] make kill-eow and kill-word consistent in considering words to consist only of alphanumeric characters. closes #3549. --- enter.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/enter.c b/enter.c index 058e5d818..9f8a45e60 100644 --- a/enter.c +++ b/enter.c @@ -460,11 +460,29 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, case OP_EDITOR_KILL_EOW: /* delete to end of word */ + + /* first skip over whitespace */ for (i = state->curpos; i < state->lastchar && iswspace (state->wbuf[i]); i++) ; - for (; i < state->lastchar && !iswspace (state->wbuf[i]); i++) - ; + + /* if there are any characters left.. */ + if (i < state->lastchar) + { + /* if the current character is alphanumeric.. */ + if (iswalnum (state->wbuf[i])) + { + /* skip over the rest of the word consistent of only alphanumerics */ + for (; i < state->lastchar && iswalnum (state->wbuf[i]); i++) + ; + } + else + { + /* skip over one non-alphanumeric character */ + ++i; + } + } + memmove (state->wbuf + state->curpos, state->wbuf + i, (state->lastchar - i) * sizeof (wchar_t)); state->lastchar += state->curpos - i; -- 2.40.0