From b0592c7b0a8fd59d679d1e52b8002c16a34839b7 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 19 Apr 2012 12:20:06 -0400 Subject: [PATCH] spiffy new strprompt() allows backspacing over the existing value --- citadel/textclient/commands.c | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/citadel/textclient/commands.c b/citadel/textclient/commands.c index 33c0d6927..426849a95 100644 --- a/citadel/textclient/commands.c +++ b/citadel/textclient/commands.c @@ -502,7 +502,15 @@ int ctdl_getline(char *string, int lim, int noshow, int bs) int ch; async_ka_start(); - scr_printf("%s", string); + if (noshow && !IsEmptyStr(string)) { + int num_stars = strlen(string); + while (num_stars--) { + scr_putc('*'); + } + } + else { + scr_printf("%s", string); + } while(1) { ch = inkey(); @@ -551,34 +559,13 @@ int ctdl_getline(char *string, int lim, int noshow, int bs) */ void strprompt(char *prompt, char *str, int len) { - int i; - char buf[128]; - print_instant(); color(DIM_WHITE); - scr_printf("%s ", prompt); - color(DIM_MAGENTA); - scr_printf("["); - color(BRIGHT_MAGENTA); - - if (len >= 0) { - scr_printf("%s", str); - } - else { - for (i=0; !IsEmptyStr(&str[i]); ++i) { - scr_printf("*"); - } - } - - color(DIM_MAGENTA); - scr_printf("]"); + scr_printf("%s", prompt); color(DIM_WHITE); scr_printf(": "); color(BRIGHT_CYAN); - ctdl_getline(buf, abs(len), (len<0), 0); - if (buf[0] != 0) { - strcpy(str, buf); - } + ctdl_getline(str, abs(len), (len<0), 0); color(DIM_WHITE); } -- 2.30.2