mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-25 01:40:19 -05:00
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.
This commit is contained in:
parent
2d7ca416f0
commit
61cabdac13
6 changed files with 160 additions and 10 deletions
18
input.c
18
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++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue