aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-02-11 21:42:30 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-02-11 21:42:30 +0530
commit671a0ef77226a1eaa3e3128bcd3d760e996283db (patch)
tree2fd077a06dc2592cbe3e41800b6a25f7e0e6a10b
parent8cdba23535d5f9ee8f375da510f44914013bc026 (diff)
downloadnnn-671a0ef77226a1eaa3e3128bcd3d760e996283db.tar.gz
Use tmp buffer to redraw()
-rw-r--r--src/nnn.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 415fd00..7602d96 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2738,8 +2738,7 @@ static void populate(char *path, char *lastname)
static void redraw(char *path)
{
- static char c;
- static char buf[12];
+ static char buf[NAME_MAX + 65] __attribute__ ((aligned));
static size_t ncols;
static int nlines, i, attrs;
static bool mode_changed;
@@ -2869,21 +2868,23 @@ static void redraw(char *path)
/* We need to show filename as it may be truncated in directory listing */
if (!cfg.blkorder)
- mvprintw(LINES - 1, 0, "%d/%d %s[%s]\n", cur + 1, ndents, sort,
- unescape(dents[cur].name, NAME_MAX));
+ snprintf(buf, NAME_MAX + 65, "%d/%d %s[%s]",
+ cur + 1, ndents, sort, unescape(dents[cur].name, NAME_MAX));
else {
- xstrlcpy(buf, coolsize(dir_blocks << BLK_SHIFT), 12);
+ i = snprintf(buf, 64, "%d/%d ", cur + 1, ndents);
+
if (cfg.apparentsz)
- c = 'a';
+ buf[i++] = 'a';
else
- c = 'd';
+ buf[i++] = 'd';
- mvprintw(LINES - 1, 0,
- "%d/%d %cu: %s (%lu files) vol: %s free [%s]\n",
- cur + 1, ndents, c, buf, num_files,
+ i += snprintf(buf + i, 64, "u: %s (%lu files) ",
+ coolsize(dir_blocks << BLK_SHIFT), num_files);
+ snprintf(buf + i, NAME_MAX, "vol: %s free [%s]",
coolsize(get_fs_info(path, FREE)),
unescape(dents[cur].name, NAME_MAX));
}
+ printmsg(buf);
} else
printmsg("0/0");
}