src/nnn.c | 9 +++++++++ diff --git a/src/nnn.c b/src/nnn.c index f103eb783431a2183f12ed56baa40f409e06e82b..4fadf59d3602d68a85b7486f494497b097985938 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -445,6 +445,7 @@ static char *mark; #ifndef NOFIFO static char *fifopath; #endif +static char *lastcmd; static ullong_t *ihashbmp; static struct entry *pdents; static blkcnt_t dir_blocks; @@ -3553,6 +3554,12 @@ break; case KEY_HOME: pos = 0; break; + case KEY_UP: // fallthrough + case KEY_DOWN: + if (prompt && lastcmd && (xstrcmp(prompt, PROMPT) == 0)) { + printmsg(prompt); + len = pos = mbstowcs(buf, lastcmd, READLINE_MAX); // fallthrough + } default: break; } @@ -5213,6 +5220,8 @@ } else tmp = getreadline("\n"PROMPT); #endif if (tmp && *tmp) { // NOLINT + free(lastcmd); + lastcmd = xstrdup(tmp); ret = TRUE; spawn(shell, "-c", tmp, NULL, F_CLI | F_CONFIRM); } else