]> Sergey Matveev's repositories - nnn.git/commitdiff
Skip a complete erase on redraw()
authorArun Prakash Jana <engineerarun@gmail.com>
Thu, 6 May 2021 07:04:31 +0000 (12:34 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Thu, 6 May 2021 07:04:31 +0000 (12:34 +0530)
src/nnn.c

index 6d0b828d5a5bb21809b1b73fdc447d4b1d582a52..0d15e80247e5a95d67bf379a4c0bd410c5a98084 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -5752,18 +5752,19 @@ static void redraw(char *path)
 
        DPRINTF_S(__func__);
 
-       /* Clear screen */
-       erase();
-
-       /* Enforce scroll/cursor invariants */
-       move_cursor(cur, 1);
-
        /* Fail redraw if < than 10 columns, context info prints 10 chars */
-       if (ncols < MIN_DISPLAY_COLS) {
+       /* Note: this should be before the Fast redraw, but we optimize */
+       if (ncols <= MIN_DISPLAY_COLS) {
+               erase();
                printmsg(messages[MSG_FEW_COLUMNS]);
                return;
        }
 
+       move(0, 0);
+
+       /* Enforce scroll/cursor invariants */
+       //move_cursor(cur, 1);
+
        //DPRINTF_D(cur);
        DPRINTF_S(path);
 
@@ -5824,11 +5825,13 @@ static void redraw(char *path)
 
        ncols = adjust_cols(ncols);
 
+       clrtoeol(); /* Clear to end of first line */
+
+       move(1, 0);
        /* Go to first entry */
-       if (curscroll > 0) {
-               move(1, 0);
+       if (curscroll > 0)
                addch('^');
-       }
+       clrtoeol(); /* Clear to end of second line */
 
        move(2, 0);
 
@@ -5847,6 +5850,8 @@ static void redraw(char *path)
                g_state.dircolor = 0;
        }
 
+       clrtobot(); /* clear to end of screen */
+
        /* Go to first entry */
        if (i < ndents) {
                move(xlines - 2, 0);