From 8b83a9f0553b317f06e289138cd9e318f6bddf30 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Wed, 23 Dec 2020 18:59:51 +0100 Subject: Enable going back to previous search matches (Shift-F3) --- CRT.c | 1 + IncSet.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CRT.c b/CRT.c index 4aaf9d65..1bd6c6d9 100644 --- a/CRT.c +++ b/CRT.c @@ -689,6 +689,7 @@ void CRT_init(const int* delay, int colorScheme, bool allowUnicode) { define_key("\033[12~", KEY_F(2)); define_key("\033[13~", KEY_F(3)); define_key("\033[14~", KEY_F(4)); + define_key("\033[14;2~", KEY_F(15)); define_key("\033[17;2~", KEY_F(18)); char sequence[3] = "\033a"; for (char c = 'a'; c <= 'z'; c++) { diff --git a/IncSet.c b/IncSet.c index 3c1d519b..043d6e6e 100644 --- a/IncSet.c +++ b/IncSet.c @@ -29,9 +29,9 @@ void IncSet_reset(IncSet* this, IncType type) { IncMode_reset(&this->modes[type]); } -static const char* const searchFunctions[] = {"Next ", "Cancel ", " Search: ", NULL}; -static const char* const searchKeys[] = {"F3", "Esc", " "}; -static const int searchEvents[] = {KEY_F(3), 27, ERR}; +static const char* const searchFunctions[] = {"Next ", "Prev ", "Cancel ", " Search: ", NULL}; +static const char* const searchKeys[] = {"F3", "S-F3", "Esc", " "}; +static const int searchEvents[] = {KEY_F(3), KEY_F(15), 27, ERR}; static inline void IncMode_initSearch(IncMode* search) { memset(search, 0, sizeof(IncMode)); @@ -141,11 +141,11 @@ bool IncSet_handleKey(IncSet* this, int ch, Panel* panel, IncMode_GetPanelValue int size = Panel_size(panel); bool filterChanged = false; bool doSearch = true; - if (ch == KEY_F(3)) { + if (ch == KEY_F(3) || ch == KEY_F(15)) { if (size == 0) return true; - IncMode_find(mode, panel, getPanelValue, 1); + IncMode_find(mode, panel, getPanelValue, ch == KEY_F(3) ? 1 : -1); doSearch = false; } else if (0 < ch && ch < 255 && isprint((unsigned char)ch)) { if (mode->index < INCMODE_MAX) { -- cgit v1.2.3