aboutsummaryrefslogtreecommitdiffstats
path: root/commands.c
diff options
context:
space:
mode:
authoreylles <eylles@noreply.codeberg.org>2023-04-14 21:45:39 +0200
committerNRK <nrk@disroot.org>2023-04-14 21:45:39 +0200
commit733916ad70b5b2d92e7adfecdf53a74dd4617b74 (patch)
treede9b410c9d73fab6be96e2f24f4e5724fdd9c716 /commands.c
parent4df97db1cd566fab1ed927986e40cc4542e937c5 (diff)
downloadnsxiv-733916ad70b5b2d92e7adfecdf53a74dd4617b74.tar.zst
add a pick quit keybind (#432)
The last time[0] this was discussed, no-one was against it but no-one was confident in it either and so it was added to nsxiv-extra as a patch. But now that enough time has passed, it seems like there's a pretty high demand for something like this because there's plenty of use-cases that use nsxiv as a "picker" where it's meant to quickly pick a single file. And so add this as a convenient default key-bind. [0]: https://codeberg.org/nsxiv/nsxiv-record/pulls/42 Co-authored-by: eylles <ed.ylles1997@gmail.com> Co-authored-by: NRK <nrk@disroot.org> Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/432 Reviewed-by: NRK <nrk@disroot.org> Co-authored-by: eylles <eylles@noreply.codeberg.org> Co-committed-by: eylles <eylles@noreply.codeberg.org>
Diffstat (limited to 'commands.c')
-rw-r--r--commands.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/commands.c b/commands.c
index 7c44ace..97cadf2 100644
--- a/commands.c
+++ b/commands.c
@@ -59,6 +59,13 @@ bool cg_quit(arg_t status)
return None; /* silence tcc warning */
}
+bool cg_pick_quit(arg_t status)
+{
+ if (options->to_stdout && markcnt == 0)
+ printf("%s%c", files[fileidx].name, options->using_null ? '\0' : '\n');
+ return cg_quit(status);
+}
+
bool cg_switch_mode(arg_t _)
{
if (mode == MODE_IMAGE) {