]> Sergey Matveev's repositories - nnn.git/commitdiff
Revert "Use KEY_RESIZE when prompting user input"
authorArun Prakash Jana <engineerarun@gmail.com>
Mon, 5 Aug 2019 13:33:55 +0000 (19:03 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Mon, 5 Aug 2019 13:33:55 +0000 (19:03 +0530)
This reverts commit ba12fa8b3d215aeb1038cc5d34de2f1b2d9e3e4b.

src/nnn.c

index d343e9767327985ce05a4602e36746985d1fce8a..5a9540766dbd8528deeb582168194a5211389d3b 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -553,15 +553,6 @@ static char *xitoa(uint val)
        return &ascbuf[++i];
 }
 
-#ifdef KEY_RESIZE
-/* Clear the old prompt */
-static inline void clearoldprompt()
-{
-       move(xlines - 1, 0);
-       clrtoeol();
-}
-#endif
-
 /* Messages show up at the bottom */
 static inline void printmsg(const char *msg)
 {
@@ -600,20 +591,7 @@ static int get_input(const char *prompt)
        if (prompt)
                printprompt(prompt);
        cleartimeout();
-#ifdef KEY_RESIZE
-       do {
-               r = getch();
-               if ( r == KEY_RESIZE) {
-                       if (prompt) {
-                               clearoldprompt();
-                               xlines = LINES;
-                               printprompt(prompt);
-                       }
-               }
-       } while ( r == KEY_RESIZE);
-#else
        r = getch();
-#endif
        settimeout();
        return r;
 }
@@ -1737,13 +1715,6 @@ static int filterentries(char *path)
 
        while ((r = get_wch(ch)) != ERR) {
                switch (*ch) {
-#ifdef KEY_RESIZE
-               case KEY_RESIZE:
-                       clearoldprompt();
-                       redraw(path);
-                       printprompt(ln);
-                       continue;
-#endif
                case KEY_DC: // fallthrough
                case  KEY_BACKSPACE: // fallthrough
                case '\b': // fallthrough
@@ -1869,7 +1840,7 @@ end:
 static char *xreadline(char *prefill, char *prompt)
 {
        size_t len, pos;
-       int x, r;
+       int x, y, r;
        const int WCHAR_T_WIDTH = sizeof(wchar_t);
        wint_t ch[2] = {0};
        wchar_t * const buf = malloc(sizeof(wchar_t) * CMD_LEN_MAX);
@@ -1891,13 +1862,13 @@ static char *xreadline(char *prefill, char *prompt)
                len = pos = 0;
        }
 
-       x = getcurx(stdscr);
+       getyx(stdscr, y, x);
        curs_set(TRUE);
 
        while (1) {
                buf[len] = ' ';
-               mvaddnwstr(xlines - 1, x, buf, len + 1);
-               move(xlines - 1, x + wcswidth(buf, pos));
+               mvaddnwstr(y, x, buf, len + 1);
+               move(y, x + wcswidth(buf, pos));
 
                r = get_wch(ch);
                if (r != ERR) {
@@ -1950,13 +1921,6 @@ static char *xreadline(char *prefill, char *prompt)
                                }
                        } else {
                                switch (*ch) {
-#ifdef KEY_RESIZE
-                               case KEY_RESIZE:
-                                       clearoldprompt();
-                                       xlines = LINES;
-                                       printprompt(prompt);
-                                       break;
-#endif
                                case KEY_LEFT:
                                        if (pos > 0)
                                                --pos;