From: Michael Hampton Date: Sun, 2 Jun 2002 16:42:18 +0000 (+0000) Subject: * Support for Ctrl-W to erase a word when editing or at a prompt X-Git-Tag: v7.86~6385 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=98a58f7e4b68ecb362cbd0e4694c733ef937aa9d;p=citadel.git * Support for Ctrl-W to erase a word when editing or at a prompt --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index fe877cd45..5f54947c9 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 591.34 2002/06/02 16:42:17 error + * Support for Ctrl-W to erase a word when editing or at a prompt + Revision 591.33 2002/05/31 18:34:04 nbryant better curses compatibility, and a couple makefile/configure tweaks @@ -3685,3 +3688,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/commands.c b/citadel/commands.c index 09c2bec8c..1e5e27444 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -495,7 +495,7 @@ int inkey(void) a = 0; if (a == 13) a = 10; - if (((a != 4) && (a != 10) && (a != 8) && (a != NEXT_KEY) && (a != STOP_KEY)) + if (((a != 23) && (a != 4) && (a != 10) && (a != 8) && (a != NEXT_KEY) && (a != STOP_KEY)) && ((a < 32) || (a > 126))) a = 0; @@ -566,15 +566,20 @@ void getline(char *string, int lim) async_ka_start(); GLA:a = inkey(); a = (a & 127); - if ((a == 8) && (strlen(string) == 0)) + if ((a == 8 || a == 23) && (strlen(string) == 0)) goto GLA; if ((a != 10) && (a != 8) && (strlen(string) == lim)) goto GLA; if ((a == 8) && (string[0] != 0)) { string[strlen(string) - 1] = 0; - scr_putc(8); - scr_putc(32); - scr_putc(8); + scr_putc(8); scr_putc(32); scr_putc(8); + goto GLA; + } + if ((a == 23) && (string[0] != 0)) { + do { + string[strlen(string) - 1] = 0; + scr_putc(8); scr_putc(32); scr_putc(8); + } while (strlen(string) && string[strlen(string) - 1] != ' '); goto GLA; } if ((a == 10)) { diff --git a/citadel/messages.c b/citadel/messages.c index 707b9dc3d..e740634fc 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -271,6 +271,13 @@ void citedit(FILE * fp) scr_putc(32); scr_putc(8); } + } else if (a == 23) { + do { + wordbuf[strlen(wordbuf) - 1] = 0; + scr_putc(8); + scr_putc(32); + scr_putc(8); + } while (strlen(wordbuf) && wordbuf[strlen(wordbuf) - 1] != ' '); } else if (a == 13) { scr_printf("\n"); if (strlen(wordbuf) == 0)