From 1fabac27ba87e32ee79036a1e9a55b42b7d1dfa4 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Fri, 14 May 2021 11:55:52 +0530 Subject: [PATCH] Fix hovered marking on empty directory --- src/nnn.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index 22aec136..6e772581 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -5726,6 +5726,14 @@ static void statusbar(char *path) tocursor(); } +static inline void markhovered(void) +{ + if (cfg.showdetail && ndents) { /* Reversed block for hovered entry */ + tocursor(); + addch(' ' | A_REVERSE); + } +} + static int adjust_cols(int n) { /* Calculate the number of cols available to print entry name */ @@ -5777,10 +5785,7 @@ static void draw_line(char *path, int ncols) if (dir) attroff(COLOR_PAIR(cfg.curctx + 1) | A_BOLD); - if (cfg.showdetail) { /* Reversed block for hovered entry */ - tocursor(); - addch(' ' | A_REVERSE); - } + markhovered(); statusbar(path); } @@ -5904,10 +5909,7 @@ static void redraw(char *path) addch('v'); } - if (cfg.showdetail) { /* Reversed block for hovered entry */ - tocursor(); - addch(' ' | A_REVERSE); - } + markhovered(); statusbar(path); }