plugins/README.md | 2 +- plugins/sxiv | 16 ++++++++++++++-- src/nnn.c | 8 +++++++- diff --git a/plugins/README.md b/plugins/README.md index 1e5a7019802ed6b1f6ffc90d6e7bdf6847392728..2fb44b06494c6e1e62bef4fae863ac13d55a380b 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -47,7 +47,7 @@ | readit | sh | pdftotext, mpv,
pico2wave | Read a PDF or text file aloud | | ringtone | sh | date, ffmpeg | Create a variable bitrate mp3 ringtone from file | | splitjoin | sh | split, cat | Split file or join selection | | suedit | sh | sudoedit/sudo/doas | Edit file using superuser permissions | -| sxiv | sh | sxiv | View images in dir, set wallpaper, copy path ([config](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts))| +| sxiv | sh | sxiv | Browse images in dir, set wallpaper, copy path ([config](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts)), [rename](https://github.com/jarun/nnn/wiki/Basic-use-cases#browse-rename-images)| | thumb | sh | [lsix](https://github.com/hackerb9/lsix) | View thumbnail of an image or dir of images | | transfer | sh | curl | Upload file to transfer.sh | | treeview | sh | tree | Informative tree output in `$EDITOR` | diff --git a/plugins/sxiv b/plugins/sxiv index ef21cf729bc00d55a8a22dc43b72d60871d0ef1c..2c677fe9e1f7cb4241582053bbc17708d7d851d2 100755 --- a/plugins/sxiv +++ b/plugins/sxiv @@ -1,8 +1,20 @@ #!/usr/bin/env sh -# Description: Open images in current directory in sxiv +# Description: Open images in hovered directory and thumbnails +# open hovered image in sxiv and browse other images in the directory # # Shell: POSIX compliant # Author: Arun Prakash Jana -sxiv -q * >/dev/null 2>&1 & +if command -v sxiv >/dev/null 2>&1; then + if ! [ -z "$1" ]; then + if [ -f "$1" ]; then + sxiv -q "$PWD" + elif [ -d "$1" ] || [ -h "$1" ]; then + sxiv -qt "$1" + fi + fi +else + echo "sxiv missing" + read dummy +fi diff --git a/src/nnn.c b/src/nnn.c index 53d8575dd85ed30eafb9cc733db8e4259747e1b5..ff3fe113daa6dea8e2e1064c9f74aa7cee16f32e 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -4591,6 +4591,8 @@ case SEL_RUNEDIT: // fallthrough case SEL_RUNPAGE: // fallthrough case SEL_LOCK: { + bool refresh = FALSE; + if (ndents) mkpath(path, dents[cur].name, newpath); else if (sel == SEL_ARCHIVELS || sel == SEL_EXTRACT @@ -4600,11 +4602,14 @@ switch (sel) { case SEL_ARCHIVELS: handle_archive(newpath, path, 'l'); + refresh = TRUE; break; case SEL_EXTRACT: handle_archive(newpath, path, 'x'); + refresh = TRUE; break; case SEL_REDRAW: + refresh = TRUE; break; case SEL_RENAMEMUL: endselection(); @@ -4613,6 +4618,7 @@ if (!batch_rename(path)) { printwait(messages[OPERATION_FAILED], &presel); goto nochange; } + refresh = TRUE; break; case SEL_HELP: show_help(path); @@ -4631,7 +4637,7 @@ /* In case of successful operation, reload contents */ /* Continue in navigate-as-you-type mode, if enabled */ - if (cfg.filtermode && sel != SEL_REDRAW) + if (cfg.filtermode && !refresh) break; /* Save current */