From: Thomas Roessler Date: Wed, 17 May 2000 08:39:38 +0000 (+0000) Subject: Add a kill-eow function to the line editor. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b98e4cadc5806620a5162d0dcbd38fd96129b41;p=neomutt Add a kill-eow function to the line editor. --- diff --git a/OPS b/OPS index 6099864b7..91e0a7831 100644 --- a/OPS +++ b/OPS @@ -67,6 +67,7 @@ OP_EDITOR_FORWARD_CHAR "move the cursor one character to the right" OP_EDITOR_HISTORY_DOWN "scroll up through the history list" OP_EDITOR_HISTORY_UP "scroll up through the history list" OP_EDITOR_KILL_EOL "delete chars from cursor to end of line" +OP_EDITOR_KILL_EOW "delete chars from the cursor to the end of the word" OP_EDITOR_KILL_LINE "delete all chars on the line" OP_EDITOR_KILL_WORD "delete the word in front of the cursor" OP_EDITOR_QUOTE_CHAR "quote the next typed key" diff --git a/enter.c b/enter.c index c8b00f336..63bb1b605 100644 --- a/enter.c +++ b/enter.c @@ -324,6 +324,19 @@ int _mutt_enter_string (unsigned char *buf, size_t buflen, int y, int x, } } break; + + case OP_EDITOR_KILL_EOW: + /* delete to end of word */ + for (j = curpos; j < lastchar && ISSPACE (buf[j]); j++) + ; + for ( ; j < lastchar && !ISSPACE (buf[j]); j++) + ; + for (ch = curpos; j < lastchar; j++, ch++) + buf[ch] = buf[j]; + lastchar = ch; + redraw = M_REDRAW_EOL; + break; + case OP_EDITOR_BUFFY_CYCLE: if (flags & M_EFILE) { @@ -502,6 +515,8 @@ int _mutt_enter_string (unsigned char *buf, size_t buflen, int y, int x, buf[curpos] = buf[curpos-1]; buf[curpos-1] = j; } + if (curpos < lastchar) + curpos++; redraw = M_REDRAW_LINE; break; diff --git a/functions.h b/functions.h index 28b84f3f7..04849decf 100644 --- a/functions.h +++ b/functions.h @@ -357,6 +357,7 @@ struct binding_t OpEditor[] = { { "forward-char", OP_EDITOR_FORWARD_CHAR, "\006" }, { "backspace", OP_EDITOR_BACKSPACE, "\010" }, { "kill-eol", OP_EDITOR_KILL_EOL, "\013" }, + { "kill-eow", OP_EDITOR_KILL_EOW, "\033d" }, { "kill-line", OP_EDITOR_KILL_LINE, "\025" }, { "quote-char", OP_EDITOR_QUOTE_CHAR, "\026" }, { "kill-word", OP_EDITOR_KILL_WORD, "\027" },