summaryrefslogtreecommitdiff
path: root/clients/tui.h
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-23 09:24:40 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-23 09:24:40 +0200
commit6159042d0cb3870e6a7c6f8d9a97e175d59e6f80 (patch)
treec6422654298a744b0a791de8f1e8ccb8e1c55071 /clients/tui.h
parent53071bb69f5d21b35b8a61c2b1dd18832ce781d4 (diff)
downloadbokf-6159042d0cb3870e6a7c6f8d9a97e175d59e6f80.tar.gz
bokf-6159042d0cb3870e6a7c6f8d9a97e175d59e6f80.zip
tui: 'g' + a letter searches list rows
The goto prompt decides on its first key: digits jump to a row number as before, any other printable key searches the row texts of the list or menu (case-insensitive, also åäö), with up/down stepping through the matches. Keys typed into the prompt no longer reach the screen's key hook, and Enter in the action menu closes an open prompt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'clients/tui.h')
-rw-r--r--clients/tui.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/clients/tui.h b/clients/tui.h
index c4fe116..4ae0da6 100644
--- a/clients/tui.h
+++ b/clients/tui.h
@@ -130,14 +130,23 @@ int tui_choice_prompt(const char *label, const char *const *opts, int n,
struct tui_list_nav {
int n, sel, top, view, numw;
- char gotobuf[12];
+ char gotobuf[64];
char gotolabel[32];
int goto_active;
+ /* The goto prompt became a search: its first key was not a digit. */
+ int goto_search;
+ int goto_miss; /* the search text matches no row */
/* Optional row flags: 0 marks a non-selectable row (a menu section
header). Navigation, numbering and goto skip them. */
const unsigned char *selectable;
+ /* Optional row texts for the goto search; NULL: digits only. */
+ const char *const *items;
};
+/* Whether needle occurs in hay, ignoring case for ASCII and the Latin-1
+ letters (Å/Ä/Ö/É…). An empty needle matches. Pure. */
+int tui_text_match(const char *hay, const char *needle);
+
/* Returns the selected index, or -1 back, -2 refresh, -4 new, -6 remove,
-7 toggle, TUI_NAV_NONE when nothing happened. */
int tui_nav_key(struct tui_list_nav *v, int ch, int allow_new,