From de4e9fc83ea58afa14a815af78edadc155bb8221 Mon Sep 17 00:00:00 2001 From: baskerville Date: Tue, 8 May 2012 16:30:56 +0200 Subject: Added a command to refresh the thumbnails --- README.md | 1 + commands.c | 18 ++++++++++++++++++ commands.h | 1 + config.def.h | 1 + sxiv.1 | 3 +++ 5 files changed, 24 insertions(+) diff --git a/README.md b/README.md index e82a91d..82a0696 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ The following general key commands are available: A Toggle visibility of alpha-channel, i.e. transparency r Reload image + R Refresh thumbnails D Remove image from file list and go to next image diff --git a/commands.c b/commands.c index d07e950..7567757 100644 --- a/commands.c +++ b/commands.c @@ -94,6 +94,24 @@ bool it_toggle_bar(arg_t a) { return true; } +bool it_refresh_thumbs(arg_t a) { + int i = 0; + if (mode == MODE_THUMB) { + win_set_cursor(&win, CURSOR_WATCH); + while (i < filecnt) { + if (!tns_load(&tns, i, &files[i], true, false)) { + remove_file(i, false); + tns.dirty = true; + if (tns.sel >= tns.cnt) + tns.sel = tns.cnt - 1; + } else { + i++; + } + } + } + return true; +} + bool it_reload_image(arg_t a) { if (mode == MODE_IMAGE) { load_image(fileidx); diff --git a/commands.h b/commands.h index 4364722..5cee27a 100644 --- a/commands.h +++ b/commands.h @@ -45,6 +45,7 @@ bool it_quit(arg_t); bool it_switch_mode(arg_t); bool it_toggle_fullscreen(arg_t); bool it_toggle_bar(arg_t); +bool it_refresh_thumbs(arg_t); bool it_reload_image(arg_t); bool it_remove_image(arg_t); bool i_navigate(arg_t); diff --git a/config.def.h b/config.def.h index f711405..cb77125 100644 --- a/config.def.h +++ b/config.def.h @@ -64,6 +64,7 @@ static const keymap_t keys[] = { { false, XK_b, it_toggle_bar, (arg_t) None }, { false, XK_r, it_reload_image, (arg_t) None }, + { false, XK_R, it_refresh_thumbs, (arg_t) None }, { false, XK_D, it_remove_image, (arg_t) None }, { false, XK_n, i_navigate, (arg_t) +1 }, diff --git a/sxiv.1 b/sxiv.1 index bf1ac32..ca6a1fc 100644 --- a/sxiv.1 +++ b/sxiv.1 @@ -117,6 +117,9 @@ Toggle visibility of alpha-channel, i.e. image transparency. .B r Reload image. .TP +.B R +Refresh thumbnails. +.TP .B D Remove current image from file list and go to next image. .SH THUMBNAIL KEYBOARD COMMANDS -- cgit v1.2.3