aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-08-27 15:23:28 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-08-27 15:23:28 +0000
commit61cabdac13986e6cb2ba69e81d5934f55d92a1a9 (patch)
tree5ad589c35e81ecb86270261514cf623739d99c35 /input.c
parentrender: 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.c18
1 files changed, 15 insertions, 3 deletions
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++) {