From 407b79bac871f9596b083440332b187ed4bb5c17 Mon Sep 17 00:00:00 2001 From: Marcel Rodrigues Date: Thu, 18 Jun 2015 16:29:11 -0300 Subject: [PATCH] Fix behavior for empty inputs. --- rover.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rover.c b/rover.c index 2619b79..fdb2bf7 100644 --- a/rover.c +++ b/rover.c @@ -953,7 +953,7 @@ main(int argc, char *argv[]) oldsel = ESEL; oldscroll = SCROLL; start_line_edit(""); - update_input(prompt, DEFAULT); + update_input(prompt, RED); while ((edit_stat = get_line_edit()) == CONTINUE) { int sel; Color color = RED; @@ -1000,10 +1000,10 @@ main(int argc, char *argv[]) int ok = 0; char *prompt = "new file: "; start_line_edit(""); - update_input(prompt, DEFAULT); + update_input(prompt, RED); while ((edit_stat = get_line_edit()) == CONTINUE) { int length = strlen(INPUT); - ok = 1; + ok = length; for (i = 0; i < rover.nfiles; i++) { if ( !strncmp(ENAME(i), INPUT, length) && @@ -1017,7 +1017,7 @@ main(int argc, char *argv[]) update_input(prompt, ok ? GREEN : RED); } clear_message(); - if (edit_stat == CONFIRM && strlen(INPUT)) { + if (edit_stat == CONFIRM) { if (ok) { addfile(INPUT); cd(1); @@ -1030,10 +1030,10 @@ main(int argc, char *argv[]) int ok = 0; char *prompt = "new directory: "; start_line_edit(""); - update_input(prompt, DEFAULT); + update_input(prompt, RED); while ((edit_stat = get_line_edit()) == CONTINUE) { int length = strlen(INPUT); - ok = 1; + ok = length; for (i = 0; i < rover.nfiles; i++) { if ( !strncmp(ENAME(i), INPUT, length) && @@ -1047,7 +1047,7 @@ main(int argc, char *argv[]) update_input(prompt, ok ? GREEN : RED); } clear_message(); - if (edit_stat == CONFIRM && strlen(INPUT)) { + if (edit_stat == CONFIRM) { if (ok) { adddir(INPUT); cd(1); @@ -1069,7 +1069,7 @@ main(int argc, char *argv[]) update_input(prompt, RED); while ((edit_stat = get_line_edit()) == CONTINUE) { int length = strlen(INPUT); - ok = 1; + ok = length; for (i = 0; i < rover.nfiles; i++) if ( !strncmp(ENAME(i), INPUT, length) && @@ -1082,7 +1082,7 @@ main(int argc, char *argv[]) update_input(prompt, ok ? GREEN : RED); } clear_message(); - if (edit_stat == CONFIRM && strlen(INPUT)) { + if (edit_stat == CONFIRM) { if (isdir) strcat(INPUT, "/"); if (ok) { -- 2.11.4.GIT