aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-02-09 16:32:40 +0100
committerBert <ber.t@gmx.com>2011-02-09 16:32:40 +0100
commit8e5835d1fd945ee9582aae71b3ee693b6ef46307 (patch)
tree51e0570310b1be112702976a35d9d70c36ff2cff /main.c
parent9be473443922a39e7cb52e605ccae922dde375a1 (diff)
downloadnsxiv-8e5835d1fd945ee9582aae71b3ee693b6ef46307.tar.zst
Handle image remove/rename while running
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/main.c b/main.c
index b0efc68..f449df9 100644
--- a/main.c
+++ b/main.c
@@ -128,12 +128,17 @@ void update_title() {
float size;
const char *unit;
- size = filesize;
- size_readable(&size, &unit);
+ if (img.valid) {
+ size = filesize;
+ size_readable(&size, &unit);
+ n = snprintf(win_title, TITLE_LEN, "sxiv: [%d/%d] <%d%%> (%.2f%s) %s",
+ fileidx + 1, filecnt, (int) (img.zoom * 100.0), size, unit,
+ filenames[fileidx]);
+ } else {
+ n = snprintf(win_title, TITLE_LEN, "sxiv: [%d/%d] broken: %s",
+ fileidx + 1, filecnt, filenames[fileidx]);
+ }
- n = snprintf(win_title, TITLE_LEN, "sxiv: [%d/%d] <%d%%> (%.2f%s) %s",
- fileidx + 1, filecnt, (int) (img.zoom * 100.0), size, unit,
- filenames[fileidx]);
if (n >= TITLE_LEN) {
win_title[TITLE_LEN - 2] = '.';
win_title[TITLE_LEN - 3] = '.';
@@ -350,7 +355,6 @@ void on_keypress(XKeyEvent *kev) {
case XK_r:
changed = load_image();
break;
-;
}
if (changed) {