Simpler questions for input

This commit is contained in:
Arun Prakash Jana 2019-01-25 22:13:20 +05:30
parent fbcc543d55
commit f4f0b9dbba

View file

@ -542,7 +542,7 @@ static int get_input(const char *prompt)
static char confirm_force() static char confirm_force()
{ {
int r = get_input("use force? (y/Y)"); int r = get_input("use force? [y/Y]");
if (r == 'y' || r == 'Y') if (r == 'y' || r == 'Y')
return 'f'; /* forceful */ return 'f'; /* forceful */
@ -3077,7 +3077,7 @@ nochange:
if (sel == SEL_CYCLE) { if (sel == SEL_CYCLE) {
(r == CTX_MAX - 1) ? (r = 0) : ++r; (r == CTX_MAX - 1) ? (r = 0) : ++r;
snprintf(newpath, PATH_MAX, snprintf(newpath, PATH_MAX,
"Create context %d? (Enter)", r + 1); "Create context %d? [Enter]", r + 1);
fd = get_input(newpath); fd = get_input(newpath);
if (fd != '\r') if (fd != '\r')
continue; continue;
@ -3512,8 +3512,8 @@ nochange:
/* Confirm if app is CLI or GUI */ /* Confirm if app is CLI or GUI */
if (sel == SEL_OPENWITH) { if (sel == SEL_OPENWITH) {
r = get_input("press 'c' for cli mode"); r = get_input("cli mode? [y/Y]");
(r == 'c') ? (r = F_NORMAL) : (r = F_NOWAIT | F_NOTRACE); (r == 'y' || r == 'Y') ? (r = F_NORMAL) : (r = F_NOWAIT | F_NOTRACE);
} }
switch (sel) { switch (sel) {
@ -3565,7 +3565,8 @@ nochange:
if (faccessat(fd, tmp, F_OK, AT_SYMLINK_NOFOLLOW) != -1) { if (faccessat(fd, tmp, F_OK, AT_SYMLINK_NOFOLLOW) != -1) {
if (sel == SEL_RENAME) { if (sel == SEL_RENAME) {
/* Overwrite file with same name? */ /* Overwrite file with same name? */
if (get_input("press 'y' to overwrite") != 'y') { r = get_input("overwrite? [y/Y]");
if (r != 'y' && r != 'Y') {
close(fd); close(fd);
break; break;
} }
@ -3726,7 +3727,7 @@ nochange:
case SEL_QUIT: case SEL_QUIT:
for (r = 0; r < CTX_MAX; ++r) for (r = 0; r < CTX_MAX; ++r)
if (r != cfg.curctx && g_ctx[r].c_cfg.ctxactive) { if (r != cfg.curctx && g_ctx[r].c_cfg.ctxactive) {
r = get_input("Quit all contexts? ('Enter' confirms)"); r = get_input("Quit all contexts? [Enter]");
break; break;
} }