From b8779e714a18b00e5c3f8172e1c425570ff8acf0 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Thu, 4 Nov 2010 10:55:07 +0000 Subject: Added "backword-kill-word" functionality to getstring(). --- ChangeLog | 5 +++++ src/utils.c | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1514337..de62c30 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-11-04 Lukas Fleischer + + * src/utils.c: Added "backword-kill-word" functionality to + getstring(). + 2010-11-01 Lukas Fleischer * 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; -- cgit v1.2.3-70-g09d2