]> Sergey Matveev's repositories - nnn.git/commitdiff
Optimize loop comparison
authorArun Prakash Jana <engineerarun@gmail.com>
Fri, 14 May 2021 07:05:43 +0000 (12:35 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Fri, 14 May 2021 07:08:07 +0000 (12:38 +0530)
src/nnn.c

index 6e7725812d95f24e6f13b592ff40695e1814fbf2..b0dae5b7b3a30c59fcbf16421eba8b298a257a3e 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -5891,8 +5891,10 @@ static void redraw(char *path)
                g_state.dircolor = 1;
        }
 
+       onscreen = MIN(onscreen + curscroll, ndents);
+
        /* Print listing */
-       for (i = curscroll; i < ndents && i < curscroll + onscreen; ++i) {
+       for (i = curscroll; i < onscreen; ++i) {
                move(++j, 0);
                printent(&pdents[i], ncols, i == cur);
        }