nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 1c14d2bb0418a758f66d8a9149161ca534fefbb1
parent 9a2bfc0f1fe4025a558ad0e1e859a946709498fb
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Sat,  3 May 2025 19:18:26 +0530

Auto-complete hovered file name on `TAB` at the end of prompt input

Diffstat:
Msrc/nnn.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/nnn.c b/src/nnn.c @@ -3708,8 +3708,12 @@ static char *xreadline(const char *prefill, const char *prompt) } continue; case '\t': - if (!(len || pos) && ndents) - len = pos = mbstowcs(buf, pdents[cur].name, READLINE_MAX); + if ((len == pos) && ndents && (pos < (READLINE_MAX - xstrlen(pdents[cur].name)))) { + buf[pos] = '\0'; + lpos = mbstowcs(NULL, pdents[cur].name, MB_CUR_MAX); + pos += mbstowcs(buf + wcslen(buf), pdents[cur].name, lpos); + len = pos; + } continue; case CONTROL('F'): if (pos < len)