linux-qubasis
linux oasis port as a qubes template
git clone https://9o.is/git/linux-qubasis.git
commit 4558a8cdd3d131f624df1fa71fc0844a72e3e2d2 parent 6d4453e03f218596b974b3f044e85fa3fdc1973d Author: Jul <jul@9o.is> Date: Thu, 31 Jul 2025 22:06:59 -0400 set fzy multi option as default config Diffstat:
| M | pkg/fzy/config.h | | | 1 | + |
| M | pkg/fzy/patches/0003-add-multi-selection.patch | | | 93 | ++++++++++++++++++++----------------------------------------------------------- |
| M | pkg/fzy/patches/0004-truncate-entries-to-terminal-width.patch | | | 4 | ++-- |
3 files changed, 26 insertions(+), 72 deletions(-)
diff --git a/pkg/fzy/config.h b/pkg/fzy/config.h @@ -21,6 +21,7 @@ extern "C" { #define DEFAULT_NUM_LINES 50 #define DEFAULT_WORKERS 0 #define DEFAULT_SHOW_INFO 0 +#define DEFAULT_MULTI 1 #ifdef __cplusplus } diff --git a/pkg/fzy/patches/0003-add-multi-selection.patch b/pkg/fzy/patches/0003-add-multi-selection.patch @@ -1,74 +1,27 @@ -From 1dc1c60924da9ab2d8af80cf89b59b65a2e81ff8 Mon Sep 17 00:00:00 2001 +From 46be6d0fb07fa23cb2e2740b31c0f7208242e770 Mon Sep 17 00:00:00 2001 From: Jul <jul@qh.is> Date: Thu, 31 Jul 2025 03:34:16 -0400 Subject: [PATCH 3/4] add multi-selection --- - src/options.c | 8 ++- - src/options.h | 1 + + src/config.def.h | 1 + src/tty_interface.c | 165 ++++++++++++++++++++++++++++++++++++++++++-- - 3 files changed, 167 insertions(+), 7 deletions(-) + 2 files changed, 160 insertions(+), 6 deletions(-) -diff --git a/src/options.c b/src/options.c -index 485fc98..3117ca6 100644 ---- a/src/options.c -+++ b/src/options.c -@@ -12,6 +12,7 @@ static const char *usage_str = - "" - "Usage: fzy [OPTION]...\n" - " -l, --lines=LINES Specify how many lines of results to show (default 10)\n" -+ " -m, --multi Enable multi-selection\n" - " -p, --prompt=PROMPT Input prompt (default '> ')\n" - " -q, --query=QUERY Use QUERY as the initial search string\n" - " -e, --show-matches=QUERY Output the sorted matches of QUERY\n" -@@ -39,6 +40,7 @@ static struct option longopts[] = {{"show-matches", required_argument, NULL, 'e' - {"workers", required_argument, NULL, 'j'}, - {"show-info", no_argument, NULL, 'i'}, - {"help", no_argument, NULL, 'h'}, -+ {"multi", no_argument, NULL, 'm'}, - {NULL, 0, NULL, 0}}; +diff --git a/src/config.def.h b/src/config.def.h +index 00d3740..27a83ce 100644 +--- a/src/config.def.h ++++ b/src/config.def.h +@@ -21,6 +21,7 @@ extern "C" { + #define DEFAULT_NUM_LINES 10 + #define DEFAULT_WORKERS 0 + #define DEFAULT_SHOW_INFO 0 ++#define DEFAULT_MULTI 0 - void options_init(options_t *options) { -@@ -54,13 +56,14 @@ void options_init(options_t *options) { - options->workers = DEFAULT_WORKERS; - options->input_delimiter = '\n'; - options->show_info = DEFAULT_SHOW_INFO; -+ options->multi = 0; + #ifdef __cplusplus } - - void options_parse(options_t *options, int argc, char *argv[]) { - options_init(options); - - int c; -- while ((c = getopt_long(argc, argv, "vhs0e:q:l:t:p:j:i", longopts, NULL)) != -1) { -+ while ((c = getopt_long(argc, argv, "mvhs0e:q:l:t:p:j:i", longopts, NULL)) != -1) { - switch (c) { - case 'v': - printf("%s " VERSION " © 2014-2025 John Hawthorn\n", argv[0]); -@@ -68,6 +71,9 @@ void options_parse(options_t *options, int argc, char *argv[]) { - case 's': - options->show_scores = 1; - break; -+ case 'm': -+ options->multi = 1; -+ break; - case '0': - options->input_delimiter = '\0'; - break; -diff --git a/src/options.h b/src/options.h -index 1a0886e..49185ba 100644 ---- a/src/options.h -+++ b/src/options.h -@@ -17,6 +17,7 @@ typedef struct { - unsigned int workers; - char input_delimiter; - int show_info; -+ int multi; - } options_t; - - void options_init(options_t *options); diff --git a/src/tty_interface.c b/src/tty_interface.c -index 6828be8..a0392bd 100644 +index 6828be8..ecff1d6 100644 --- a/src/tty_interface.c +++ b/src/tty_interface.c @@ -7,6 +7,126 @@ @@ -85,7 +38,7 @@ index 6828be8..a0392bd 100644 +static void +init_selection_marks(tty_interface_t *state) +{ -+ if (state->options->multi == 0) { ++ if (DEFAULT_MULTI == 0) { + return; + } + @@ -178,7 +131,7 @@ index 6828be8..a0392bd 100644 +static void +free_selection_marks(tty_interface_t *state) +{ -+ if (state->options->multi == 1) { ++ if (DEFAULT_MULTI == 1) { + free(selection_marks); + selection_marks = (size_t *)NULL; + } @@ -203,7 +156,7 @@ index 6828be8..a0392bd 100644 tty_t *tty = state->tty; - tty_setcol(tty, 0); -+ tty_setcol(tty, state->options->multi ? 2 : 0); ++ tty_setcol(tty, DEFAULT_MULTI ? 2 : 0); size_t line = 0; while (line++ < state->options->num_lines + (state->options->show_info ? 1 : 0)) { tty_newline(tty); @@ -212,12 +165,12 @@ index 6828be8..a0392bd 100644 tty_hide_cursor(tty); - tty_setcol(tty, 0); -+ tty_setcol(tty, options->multi ? 2 : 0); ++ tty_setcol(tty, DEFAULT_MULTI ? 2 : 0); tty_printf(tty, "%s%s", options->prompt, state->search); tty_clearline(tty); - if (options->show_info) { -+ if (options->show_info && options->multi) { ++ if (options->show_info && DEFAULT_MULTI) { + tty_printf(tty, "\n[%lu/%lu/%lu]", count_selections(state), choices->available, choices->size); + tty_clearline(tty); + } else if (options->show_info) { @@ -228,7 +181,7 @@ index 6828be8..a0392bd 100644 tty_clearline(tty); const char *choice = choices_get(choices, i); if (choice) { -+ if (options->multi == 1 && selection_marks[i] == 1) { ++ if (DEFAULT_MULTI == 1 && selection_marks[i] == 1) { + tty_printf(tty, "%*c %s", 1, '*', ""); + } else { + tty_printf(tty, "%*s", 2, ""); @@ -241,7 +194,7 @@ index 6828be8..a0392bd 100644 tty_moveup(tty, num_lines + options->show_info); - tty_setcol(tty, 0); -+ tty_setcol(tty, options->multi ? 2 : 0); ++ tty_setcol(tty, DEFAULT_MULTI ? 2 : 0); fputs(options->prompt, tty->fout); for (size_t i = 0; i < state->cursor; i++) fputc(state->search[i], tty->fout); @@ -249,7 +202,7 @@ index 6828be8..a0392bd 100644 static void action_emit(tty_interface_t *state) { update_state(state); -+ if (state->options->multi == 1) { ++ if (DEFAULT_MULTI == 1) { + char **s = save_selections(state); + free_selection_marks(state); + @@ -272,7 +225,7 @@ index 6828be8..a0392bd 100644 } static void action_autocomplete(tty_interface_t *state) { -+ if (state->options->multi == 1) { ++ if (DEFAULT_MULTI == 1) { + action_select(state); + return; + } diff --git a/pkg/fzy/patches/0004-truncate-entries-to-terminal-width.patch b/pkg/fzy/patches/0004-truncate-entries-to-terminal-width.patch @@ -1,4 +1,4 @@ -From f114be31ff2eec623cc3b4a960017b47a23e783f Mon Sep 17 00:00:00 2001 +From 46c48eae9ebfd86f9d6ba51ac73438b10d242c9b Mon Sep 17 00:00:00 2001 From: Jul <jul@qh.is> Date: Thu, 31 Jul 2025 05:34:48 -0400 Subject: [PATCH 4/4] truncate entries to terminal width @@ -8,7 +8,7 @@ Subject: [PATCH 4/4] truncate entries to terminal width 1 file changed, 14 insertions(+) diff --git a/src/tty_interface.c b/src/tty_interface.c -index a0392bd..711b797 100644 +index ecff1d6..62f20ac 100644 --- a/src/tty_interface.c +++ b/src/tty_interface.c @@ -2,6 +2,8 @@