summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2000-05-17 08:39:38 +0000
committerThomas Roessler <roessler@does-not-exist.org>2000-05-17 08:39:38 +0000
commita8b89f675fa7087e010281940cd6e5c49833ec52 (patch)
treeb59a0b6c3fef95e64ebb564d97d9c1b944beda6d
parentf49edf7e247ea97f61094bed0dae65fec1e28a4f (diff)
Add a kill-eow function to the line editor.
-rw-r--r--OPS1
-rw-r--r--enter.c15
-rw-r--r--functions.h1
3 files changed, 17 insertions, 0 deletions
diff --git a/OPS b/OPS
index 6099864b..91e0a783 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 c8b00f33..63bb1b60 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 28b84f3f..04849dec 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" },