OP_EDIT_MESSAGE "edit the raw message"
OP_EDITOR_BACKSPACE "delete the char in front of the cursor"
OP_EDITOR_BACKWARD_CHAR "move the cursor one character to the left"
+OP_EDITOR_BACKWARD_WORD "move the cursor to the beginning of the word"
OP_EDITOR_BOL "jump to the beginning of the line"
OP_EDITOR_BUFFY_CYCLE "cycle among incoming mailboxes"
OP_EDITOR_COMPLETE "complete filename or alias"
OP_EDITOR_DELETE_CHAR "delete the char under the cursor"
OP_EDITOR_EOL "jump to the end of the line"
OP_EDITOR_FORWARD_CHAR "move the cursor one character to the right"
+OP_EDITOR_FORWARD_WORD "move the cursor to the end of the word"
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"
}
}
break;
+ case OP_EDITOR_BACKWARD_WORD:
+ if (curpos == 0)
+ {
+ BEEP ();
+ }
+ else
+ {
+ if (curpos > 0 && !ISSPACE (buf[curpos]) && ISSPACE (buf[curpos - 1]))
+ curpos--;
+ while (curpos > 0 && ISSPACE (buf[curpos]))
+ curpos--;
+ while (curpos > 0 && !ISSPACE (buf[curpos]))
+ curpos--;
+ if (ISSPACE (buf[curpos]) && !ISSPACE (buf[curpos + 1]))
+ curpos++;
+
+ if (!pass)
+ {
+ if (curpos < begin)
+ {
+ begin = curpos - width/2;
+ redraw = M_REDRAW_LINE;
+ }
+ else
+ move (y, x + curpos - begin);
+ }
+ }
+ break;
+
+ case OP_EDITOR_FORWARD_WORD:
+ if (curpos == lastchar)
+ {
+ BEEP ();
+ }
+ else
+ {
+ while (curpos < lastchar && ISSPACE (buf[curpos]))
+ curpos++;
+ while (curpos < lastchar && !ISSPACE (buf[curpos]))
+ curpos++;
+
+ if (!pass)
+ {
+ if (curpos >= begin + width)
+ {
+ begin = curpos - width / 2;
+ redraw = M_REDRAW_LINE;
+ }
+ else
+ move (y, x + curpos - begin);
+ }
+ }
+ break;
+
case OP_EDITOR_DELETE_CHAR:
if (curpos != lastchar)
{
struct binding_t OpEditor[] = {
{ "bol", OP_EDITOR_BOL, "\001" },
{ "backward-char", OP_EDITOR_BACKWARD_CHAR, "\002" },
+ { "backward-word", OP_EDITOR_BACKWARD_WORD, "\033b"},
{ "delete-char", OP_EDITOR_DELETE_CHAR, "\004" },
{ "eol", OP_EDITOR_EOL, "\005" },
{ "forward-char", OP_EDITOR_FORWARD_CHAR, "\006" },
+ { "forward-word", OP_EDITOR_FORWARD_WORD, "\033f"},
{ "backspace", OP_EDITOR_BACKSPACE, "\010" },
{ "kill-eol", OP_EDITOR_KILL_EOL, "\013" },
- { "kill-eow", OP_EDITOR_KILL_EOW, "\033d" },
+ { "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" },
- { "complete", OP_EDITOR_COMPLETE, "\t" },
+ { "complete", OP_EDITOR_COMPLETE, "\t" },
{ "complete-query", OP_EDITOR_COMPLETE_QUERY, "\024" },
- { "buffy-cycle", OP_EDITOR_BUFFY_CYCLE, " " },
- { "history-up", OP_EDITOR_HISTORY_UP, NULL },
- { "history-down", OP_EDITOR_HISTORY_DOWN, NULL },
- { "transpose-chars", OP_EDITOR_TRANSPOSE_CHARS, NULL },
- { NULL, 0, NULL }
+ { "buffy-cycle", OP_EDITOR_BUFFY_CYCLE, " " },
+ { "history-up", OP_EDITOR_HISTORY_UP, NULL },
+ { "history-down", OP_EDITOR_HISTORY_DOWN, NULL },
+ { "transpose-chars", OP_EDITOR_TRANSPOSE_CHARS, NULL },
+ { NULL, 0, NULL }
};