From 004fcd5c5b0bbd74b643fc1959102a274593d257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Thu, 7 Dec 2017 14:08:37 +0100 Subject: [PATCH] Left bar shows file name as given by user --- Makefile | 2 +- main.c | 24 +++++------------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 304f2a9..bd8f0ea 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = git-20171123 +VERSION = git-20171207 srcdir = . VPATH = $(srcdir) diff --git a/main.c b/main.c index 0bafac5..a2c37e2 100644 --- a/main.c +++ b/main.c @@ -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); - } } }