]> granicus.if.org Git - neomutt/commitdiff
Add a kill-eow function to the line editor.
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 17 May 2000 08:39:38 +0000 (08:39 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 17 May 2000 08:39:38 +0000 (08:39 +0000)
OPS
enter.c
functions.h

diff --git a/OPS b/OPS
index 6099864b72057de6e3d0c472dc82d4885387bb9f..91e0a783172d1eeec6ce39fd1ef0b6bce11e8bb1 100644 (file)
--- 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 c8b00f3365d397b899ce8eb6ec9d73418b37c5bb..63bb1b6058e95c22dc6839f2eec5b04e9541d7ef 100644 (file)
--- 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;
 
index 28b84f3f76f0b979c687fc085ebec35ae61a6878..04849decf2adaa6ca69bc5264203e56f5bfdd57d 100644 (file)
@@ -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" },