* Support for Ctrl-W to erase a word when editing or at a prompt
authorMichael Hampton <io_error@uncensored.citadel.org>
Sun, 2 Jun 2002 16:42:18 +0000 (16:42 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sun, 2 Jun 2002 16:42:18 +0000 (16:42 +0000)
citadel/ChangeLog
citadel/commands.c
citadel/messages.c

index fe877cd456da012cea89d6f3d89d62f091e9551f..5f54947c93220c3f08755843220ac7d979cce45d 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 09c2bec8c87fe49d85a1c43978e43120023983d6..1e5e274440cf8b58d56b9c665f153dd9278b2406 100644 (file)
@@ -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)) {
index 707b9dc3da17370574cafd261361cffbd17355aa..e740634fca9c3069e0161c4cb71331d3b5c81861 100644 (file)
@@ -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)