Left bar shows file name as given by user

This commit is contained in:
Bert Münnich 2017-12-07 14:08:37 +01:00
parent eb96c71725
commit 004fcd5c5b
2 changed files with 6 additions and 20 deletions

View file

@ -1,4 +1,4 @@
VERSION = git-20171123
VERSION = git-20171207
srcdir = .
VPATH = $(srcdir)

24
main.c
View file

@ -340,7 +340,6 @@ void update_info(void)
unsigned int i, fn, fw;
char title[256];
const char * mark;
bool ow_info;
win_bar_t *l = &win.bar.l, *r = &win.bar.r;
/* update window title */
@ -359,15 +358,12 @@ void update_info(void)
l->p = l->buf;
r->p = r->buf;
if (mode == MODE_THUMB) {
if (tns.loadnext < tns.end) {
if (tns.loadnext < tns.end)
bar_put(l, "Loading... %0*d", fw, tns.loadnext + 1);
ow_info = false;
} else if (tns.initnext < filecnt) {
else if (tns.initnext < filecnt)
bar_put(l, "Caching... %0*d", fw, tns.initnext + 1);
ow_info = false;
} else {
ow_info = true;
}
else
strncpy(l->buf, files[fileidx].name, l->size);
bar_put(r, "%s%0*d/%d", mark, fw, fileidx + 1, filecnt);
} else {
bar_put(r, "%s", mark);
@ -385,18 +381,8 @@ void update_info(void)
bar_put(r, "%0*d/%d | ", fn, img.multi.sel + 1, img.multi.cnt);
}
bar_put(r, "%0*d/%d", fw, fileidx + 1, filecnt);
ow_info = info.f.err != 0;
}
if (ow_info) {
fn = strlen(files[fileidx].name);
if (fn < l->size &&
win_textwidth(&win.env, files[fileidx].name, fn, true, NULL) +
win_textwidth(&win.env, r->buf, r->p - r->buf, true, NULL) < win.w)
{
if (info.f.err)
strncpy(l->buf, files[fileidx].name, l->size);
} else {
strncpy(l->buf, files[fileidx].base, l->size);
}
}
}