Replacement ctdl_getline()
authorArt Cancro <ajc@uncensored.citadel.org>
Thu, 19 Apr 2012 16:09:10 +0000 (12:09 -0400)
committerArt Cancro <ajc@uncensored.citadel.org>
Thu, 19 Apr 2012 16:09:10 +0000 (12:09 -0400)
citadel/textclient/commands.c

index a1ac0350187bb9673bce53543c0ba3660df40685..33c0d6927ea7ca3b00e8eceed10f6c08c7fa1b6c 100644 (file)
@@ -492,7 +492,7 @@ int yesno_d(int d)
  * string              Pointer to string buffer
  * lim                 Maximum length
  * noshow              Echo asterisks instead of keystrokes?
- * bs                  Allow backspacing out of the prompt? (NOT IMPLEMENTED YET)
+ * bs                  Allow backspacing out of the prompt? (returns -1 if this happens)
  *
  * returns: string length
  */
@@ -512,6 +512,11 @@ int ctdl_getline(char *string, int lim, int noshow, int bs)
                        scr_putc(8); scr_putc(32); scr_putc(8);
                }
 
+               else if ((ch == 8) && (pos == 0) && (bs)) {             /* backspace out of the prompt */
+                       async_ka_end();
+                       return(-1);
+               }
+
                else if ((ch == 23) && (pos > 0)) {                     /* Ctrl-W deletes a word */
                        while ((pos > 0) && !isspace(string[pos])) {
                                --pos;