mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Use tmp buffer to redraw()
This commit is contained in:
parent
8cdba23535
commit
671a0ef772
25
src/nnn.c
25
src/nnn.c
|
@ -2738,8 +2738,7 @@ static void populate(char *path, char *lastname)
|
||||||
|
|
||||||
static void redraw(char *path)
|
static void redraw(char *path)
|
||||||
{
|
{
|
||||||
static char c;
|
static char buf[NAME_MAX + 65] __attribute__ ((aligned));
|
||||||
static char buf[12];
|
|
||||||
static size_t ncols;
|
static size_t ncols;
|
||||||
static int nlines, i, attrs;
|
static int nlines, i, attrs;
|
||||||
static bool mode_changed;
|
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 */
|
/* We need to show filename as it may be truncated in directory listing */
|
||||||
if (!cfg.blkorder)
|
if (!cfg.blkorder)
|
||||||
mvprintw(LINES - 1, 0, "%d/%d %s[%s]\n", cur + 1, ndents, sort,
|
snprintf(buf, NAME_MAX + 65, "%d/%d %s[%s]",
|
||||||
unescape(dents[cur].name, NAME_MAX));
|
cur + 1, ndents, sort, unescape(dents[cur].name, NAME_MAX));
|
||||||
else {
|
else {
|
||||||
xstrlcpy(buf, coolsize(dir_blocks << BLK_SHIFT), 12);
|
i = snprintf(buf, 64, "%d/%d ", cur + 1, ndents);
|
||||||
if (cfg.apparentsz)
|
|
||||||
c = 'a';
|
|
||||||
else
|
|
||||||
c = 'd';
|
|
||||||
|
|
||||||
mvprintw(LINES - 1, 0,
|
if (cfg.apparentsz)
|
||||||
"%d/%d %cu: %s (%lu files) vol: %s free [%s]\n",
|
buf[i++] = 'a';
|
||||||
cur + 1, ndents, c, buf, num_files,
|
else
|
||||||
|
buf[i++] = 'd';
|
||||||
|
|
||||||
|
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)),
|
coolsize(get_fs_info(path, FREE)),
|
||||||
unescape(dents[cur].name, NAME_MAX));
|
unescape(dents[cur].name, NAME_MAX));
|
||||||
}
|
}
|
||||||
|
printmsg(buf);
|
||||||
} else
|
} else
|
||||||
printmsg("0/0");
|
printmsg("0/0");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue