foot/search.h
Daniel Eklöf 90c91d6148
search/render: initial support for highlighting all visible matches
Before this patch, only the currently “selected” match was
highlighted (by having the “selected” attribute, and by *not* dimming
it, like the rest of the grid during a scrollback search).

With this patch, we now highlight matches within the viewport. While
searching, only the “primary” match is searched-for, and tracked.

Then, when rendering a frame, we find all “secondary” matches as
well. “holes” are added to the search-mode overlay by the means of an
search-match iterator.

The iterator’s text matching logic is *very* similar to what we do
when the search criteria has been updated, and we re-search the
scrollback. It should be possible to refactor this, and share code.
2022-04-16 19:26:20 +02:00

24 lines
770 B
C

#pragma once
#include <xkbcommon/xkbcommon.h>
#include "terminal.h"
void search_begin(struct terminal *term);
void search_cancel(struct terminal *term);
void search_input(
struct seat *seat, struct terminal *term, uint32_t key,
xkb_keysym_t sym, xkb_mod_mask_t mods, xkb_mod_mask_t consumed,
xkb_mod_mask_t locked,
const xkb_keysym_t *raw_syms, size_t raw_count,
uint32_t serial);
void search_add_chars(struct terminal *term, const char *text, size_t len);
void search_selection_cancelled(struct terminal *term);
struct search_match_iterator {
struct terminal *term;
struct coord start;
};
struct search_match_iterator search_matches_new_iter(struct terminal *term);
struct range search_matches_next(struct search_match_iterator *iter);