diff options
-rwxr-xr-x | ChangeLog | 5 | ||||
-rwxr-xr-x | src/utils.c | 21 |
2 files changed, 25 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2010-11-04 Lukas Fleischer <calcurse@cryptocrack.de> + + * src/utils.c: Added "backword-kill-word" functionality to + getstring(). + 2010-11-01 Lukas Fleischer <calcurse@cryptocrack.de> * src/calcurse.1 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; |