diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2020-11-10 19:13:38 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2020-11-10 19:13:38 +0530 |
commit | c674cb5934b926787724f10c7ccbf24d1349dd67 (patch) | |
tree | ef7693a14886649b62d711966cdf7ed69f2511dc | |
parent | 1418ecde0dc28dc7d32a9ffdcf0721db7bd2d624 (diff) | |
download | nnn-c674cb5934b926787724f10c7ccbf24d1349dd67.tar.gz |
Fix #775: quit on double Esc
-rw-r--r-- | src/nnn.c | 30 | ||||
-rw-r--r-- | src/nnn.h | 7 |
2 files changed, 20 insertions, 17 deletions
@@ -774,6 +774,9 @@ static int (*nftw_fn)(const char *fpath, const struct stat *sb, int typeflag, st static void move_cursor(int target, int ignore_scrolloff); static char *load_input(int fd, const char *path); static int set_sort_flags(int r); +#ifndef NOFIFO +static void notify_fifo(bool force); +#endif /* Functions */ @@ -2549,8 +2552,10 @@ static int nextsel(int presel) #endif int c = presel; uint i; + bool escaped = FALSE; if (c == 0 || c == MSGWAIT) { +try_quit: c = getch(); //DPRINTF_D(c); //DPRINTF_S(keyname(c)); @@ -2566,9 +2571,19 @@ static int nextsel(int presel) ungetch(c); c = ';'; } - } else - c = ESC; - settimeout(); + settimeout(); + } else if (escaped) { + settimeout(); + c = CONTROL('Q'); + } else { +#ifndef NOFIFO + /* Send hovered path to NNN_FIFO */ + notify_fifo(TRUE); +#endif + escaped = TRUE; + settimeout(); + goto try_quit; + } } if (c == ERR && presel == MSGWAIT) @@ -4582,7 +4597,7 @@ static void show_help(const char *path) "a1-4 Context 1-4%-7c(Sh)Tab Cycle context\n" "aEsc Send to FIFO%-11c^L Redraw\n" "c? Help, conf%-13c^G QuitCD\n" - "cq Quit context%-7c^Q (Q) Quit (with err)\n" + "2^Q 2Esc (Q) Quit (with err)%-9cq Quit context\n" "1FILTER & PROMPT\n" "c/ Filter%-12cAlt+Esc Clear filter & redraw\n" "aEsc Exit prompt%-12c^L Clear prompt/last filter\n" @@ -4593,7 +4608,7 @@ static void show_help(const char *path) "b^R Rename/dup%-14cr Batch rename\n" "cz Archive%-17ce Edit file\n" "c* Toggle exe%-14c> Export list\n" - "5Space ^J (Un)select%-7cm ^Space Mark range/clear\n" + "5Space ^J (Un)select%-7cm ^Space Mark range/clear sel\n" "9p ^P Copy sel here%-11ca Select all\n" "9v ^V Move sel here%-8cw ^W Cp/mv sel as\n" "9x ^X Delete%-18cE Edit sel\n" @@ -7068,11 +7083,6 @@ nochange: selbufpos = 0; } return sel == SEL_QUITFAIL ? EXIT_FAILURE : EXIT_SUCCESS; -#ifndef NOFIFO - case SEL_FIFO: - notify_fifo(TRUE); - goto nochange; -#endif default: if (xlines != LINES || xcols != COLS) continue; @@ -112,9 +112,6 @@ enum action { SEL_QUITCD, SEL_QUIT, SEL_QUITFAIL, -#ifndef NOFIFO - SEL_FIFO, -#endif #ifndef NOMOUSE SEL_CLICK, #endif @@ -274,10 +271,6 @@ static struct key bindings[] = { { CONTROL('Q'), SEL_QUIT }, /* Quit with an error code */ { 'Q', SEL_QUITFAIL }, -#ifndef NOFIFO - /* Send hovered path to NNN_FIFO */ - { ESC, SEL_FIFO }, -#endif #ifndef NOMOUSE { KEY_MOUSE, SEL_CLICK }, #endif |