summaryrefslogtreecommitdiffstats
path: root/enter.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2000-10-27 10:35:04 +0000
committerThomas Roessler <roessler@does-not-exist.org>2000-10-27 10:35:04 +0000
commit0a1771d4dc71fc9f197ff6d5a5d13ead116f5956 (patch)
tree32317a7a6fc46cc231fcd3aab547825a90644c48 /enter.c
parentf31f6d240cb6b75bcbf433c7d2ca24fbe75a5303 (diff)
Add capitalize-word, upcase-word, downcase-word functions to the
editor. Bindings follow the Emacs conventions (i.e., M-c, M-u, M-d).
Diffstat (limited to 'enter.c')
-rw-r--r--enter.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/enter.c b/enter.c
index a9307223..6795ddc7 100644
--- a/enter.c
+++ b/enter.c
@@ -331,6 +331,60 @@ int _mutt_enter_string (unsigned char *buf, size_t buflen, int y, int x,
}
break;
+ case OP_EDITOR_CAPITALIZE_WORD:
+ if (curpos == lastchar)
+ {
+ BEEP ();
+ break;
+ }
+ while (curpos < lastchar && ISSPACE (buf[curpos]))
+ curpos++;
+ if (curpos < lastchar)
+ {
+ buf[curpos] = toupper (buf[curpos]);
+ curpos++;
+ }
+ if (curpos == lastchar || ISSPACE (buf[curpos]))
+ {
+ if (!pass)
+ {
+ if (curpos >= begin + width)
+ begin = curpos - width / 2;
+ else
+ move (y, x + curpos - begin);
+ redraw = M_REDRAW_LINE;
+ }
+ break;
+ }
+
+ /* fall through */
+ case OP_EDITOR_UPCASE_WORD:
+ case OP_EDITOR_DOWNCASE_WORD:
+ if (curpos == lastchar)
+ {
+ BEEP();
+ break;
+ }
+ while (curpos < lastchar && ISSPACE (buf[curpos]))
+ curpos++;
+ while (curpos < lastchar && !ISSPACE(buf[curpos]))
+ {
+ if (ch == OP_EDITOR_UPCASE_WORD)
+ buf[curpos] = toupper (buf[curpos]);
+ else /* DOWNCASE_WORD, CAPITALIZE_WORD */
+ buf[curpos] = tolower (buf[curpos]);
+ curpos++;
+ }
+ if (!pass)
+ {
+ if (curpos >= begin + width)
+ begin = curpos - width / 2;
+ else
+ move (y, x + curpos - begin);
+ redraw = M_REDRAW_LINE;
+ }
+ break;
+
case OP_EDITOR_DELETE_CHAR:
if (curpos != lastchar)
{