From 1094def1833c19b4fcb84954f2ae2aaf36dd7a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Sun, 17 Aug 2014 20:27:01 +0200 Subject: [PATCH] Added command to remove all image marks, bound to Ctrl-m; fixes issue #163 --- README.md | 1 + commands.c | 12 ++++++++++++ commands.lst | 1 + config.def.h | 1 + sxiv.1 | 3 +++ 5 files changed, 18 insertions(+) diff --git a/README.md b/README.md index ccecbbe..70c65f6 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ of small previews is displayed, making it easy to choose an image to open. Ctrl-h,j,k,l Scroll one window width/height left/down/up/right m Mark/unmark current image M Reverse all image marks + Ctrl-m Remove all image marks N Go [count] marked images forward P Go [count] marked images backward diff --git a/commands.c b/commands.c index f6f155c..8fb3296 100644 --- a/commands.c +++ b/commands.c @@ -215,6 +215,18 @@ bool cg_reverse_marks(arg_t a) return true; } +bool cg_unmark_all(arg_t a) +{ + int i; + + for (i = 0; i < filecnt; i++) + files[i].marked = false; + markcnt = 0; + if (mode == MODE_THUMB) + tns.dirty = true; + return true; +} + bool cg_navigate_marked(arg_t a) { long n = (long) a; diff --git a/commands.lst b/commands.lst index ece3f48..5dd401d 100644 --- a/commands.lst +++ b/commands.lst @@ -10,6 +10,7 @@ G_CMD(n_or_last) G_CMD(scroll_screen) G_CMD(toggle_image_mark) G_CMD(reverse_marks) +G_CMD(unmark_all) G_CMD(navigate_marked) I_CMD(navigate) diff --git a/config.def.h b/config.def.h index 6f355b5..913f7ac 100644 --- a/config.def.h +++ b/config.def.h @@ -81,6 +81,7 @@ static const keymap_t keys[] = { { ControlMask, XK_Right, g_scroll_screen, (arg_t) DIR_RIGHT }, { 0, XK_m, g_toggle_image_mark, (arg_t) None }, { 0, XK_M, g_reverse_marks, (arg_t) None }, + { ControlMask, XK_m, g_unmark_all, (arg_t) None }, { 0, XK_N, g_navigate_marked, (arg_t) +1 }, { 0, XK_P, g_navigate_marked, (arg_t) -1 }, diff --git a/sxiv.1 b/sxiv.1 index 06c360e..c618189 100644 --- a/sxiv.1 +++ b/sxiv.1 @@ -146,6 +146,9 @@ Mark/unmark the current image. .B M Reverse all image marks. .TP +.B Ctrl-m +Remove all image marks. +.TP .B N Go .I count