diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-08-27 15:23:28 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-08-27 15:23:28 +0000 |
| commit | 61cabdac13986e6cb2ba69e81d5934f55d92a1a9 (patch) | |
| tree | 5ad589c35e81ecb86270261514cf623739d99c35 /input.c | |
| parent | render: center grid in window (diff) | |
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.
Diffstat (limited to 'input.c')
| -rw-r--r-- | input.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -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++) { |
