]> Sergey Matveev's repositories - nnn.git/commitdiff
Press TAB to insert current file name at prompt
authorArun Prakash Jana <engineerarun@gmail.com>
Wed, 21 Jul 2021 05:54:46 +0000 (11:24 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Wed, 21 Jul 2021 05:54:46 +0000 (11:24 +0530)
src/nnn.c

index 53ccffac682ffa7da7a81d3605c9fd8a6b0b2d8a..d96509ab5a597e24fa014c0fca2569ceaedce850 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3457,8 +3457,11 @@ static char *xreadline(const char *prefill, const char *prompt)
                                        memmove(buf + pos - 1, buf + pos,
                                                (len - pos) * WCHAR_T_WIDTH);
                                        --len, --pos;
-                               } // fallthrough
-                       case '\t': /* Tab breaks cursor position, ignore it */
+                               }
+                               continue;
+                       case '\t':
+                               if (!(len || pos) && ndents)
+                                       len = pos = mbstowcs(buf, pdents[cur].name, READLINE_MAX);
                                continue;
                        case CONTROL('F'):
                                if (pos < len)