summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2010-11-04 10:55:07 +0000
committerLukas Fleischer <calcurse@cryptocrack.de>2010-11-04 10:55:07 +0000
commitb8779e714a18b00e5c3f8172e1c425570ff8acf0 (patch)
tree3fbdad74e4239a0cafda2de2ef21186820e70218 /src
parent0cb57bb247dfb9c0c3f20ebf07bfea81069464bc (diff)
downloadcalcurse-b8779e714a18b00e5c3f8172e1c425570ff8acf0.tar.gz
calcurse-b8779e714a18b00e5c3f8172e1c425570ff8acf0.zip
Added "backword-kill-word" functionality to getstring().
Diffstat (limited to 'src')
-rwxr-xr-xsrc/utils.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index d18b8bc..243de4c 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/* $calcurse: utils.c,v 1.85 2010/10/23 10:25:53 culot Exp $ */
+/* $calcurse: utils.c,v 1.86 2010/11/04 10:55:07 fleischer Exp $ */
/*
* Calcurse - text-based organizer
@@ -362,6 +362,25 @@ getstring (WINDOW *win, char *str, int l, int x, int y)
printf ("\a");
break;
+ case CTRL ('W'): /* delete a word */
+ while (len > 0 && newpos > x && *(orig + newpos - 1) == ' ') {
+ --newpos;
+ --len;
+ if (newpos >= x + len)
+ --str;
+ else
+ del_char (newpos, orig);
+ }
+ while (len > 0 && newpos > x && *(orig + newpos - 1) != ' ') {
+ --newpos;
+ --len;
+ if (newpos >= x + len)
+ --str;
+ else
+ del_char (newpos, orig);
+ }
+ break;
+
case CTRL ('K'): /* delete to end-of-line */
str = orig + newpos;
*str = 0;