From 61cabdac13986e6cb2ba69e81d5934f55d92a1a9 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 27 Aug 2019 17:23:28 +0200 Subject: search: wip: re-direct input while searching, and build a search buffer This adds a new state, 'is_searching'. While active, input is re-directed, and stored in a search buffer. In the future, we'll use this buffer and search for its content in the scrollback buffer, and move the view and create a selection on matches. When rendering in 'is_searching', everything is dimmed. In the future, we'll render the current search buffer on-top of the dimmed "regular" terminal output. --- input.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index dc48b44d..4384cead 100644 --- a/input.c +++ b/input.c @@ -18,11 +18,12 @@ #define LOG_MODULE "input" #define LOG_ENABLE_DBG 0 #include "log.h" -#include "terminal.h" -#include "render.h" -#include "keymap.h" #include "commands.h" +#include "keymap.h" +#include "render.h" +#include "search.h" #include "selection.h" +#include "terminal.h" #include "vt.h" static void @@ -178,6 +179,12 @@ keyboard_key(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, xkb_mod_mask_t significant = ctrl | alt | shift | meta; xkb_mod_mask_t effective_mods = mods & ~consumed & significant; + if (term->is_searching) { + start_repeater(term, key - 8); + search_input(term, key, sym, effective_mods); + return; + } + #if 0 for (size_t i = 0; i < 32; i++) { if (mods & (1 << i)) { @@ -220,6 +227,11 @@ keyboard_key(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, selection_from_clipboard(term, serial); found_map = true; } + + else if (sym == XKB_KEY_R) { + search_begin(term); + found_map = true; + } } for (size_t i = 0; i < sizeof(key_map) / sizeof(key_map[0]) && !found_map; i++) { -- cgit v1.3