mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
search: new function: search_add_chars()
This function inserts a string into the search buffer, at the current insertion point (i.e. where the cursor is).
This commit is contained in:
parent
7eea6f94ed
commit
f51ce34753
2 changed files with 5 additions and 4 deletions
8
search.c
8
search.c
|
|
@ -332,8 +332,8 @@ search_find_next(struct terminal *term)
|
|||
#undef ROW_DEC
|
||||
}
|
||||
|
||||
static void
|
||||
add_chars(struct terminal *term, const char *src, size_t count)
|
||||
void
|
||||
search_add_chars(struct terminal *term, const char *src, size_t count)
|
||||
{
|
||||
mbstate_t ps = {0};
|
||||
size_t wchars = mbsnrtowcs(NULL, &src, count, 0, &ps);
|
||||
|
|
@ -494,7 +494,7 @@ static void
|
|||
from_clipboard_cb(char *text, size_t size, void *user)
|
||||
{
|
||||
struct terminal *term = user;
|
||||
add_chars(term, text, size);
|
||||
search_add_chars(term, text, size);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -722,7 +722,7 @@ search_input(struct seat *seat, struct terminal *term, uint32_t key,
|
|||
if (count == 0)
|
||||
return;
|
||||
|
||||
add_chars(term, (const char *)buf, count);
|
||||
search_add_chars(term, (const char *)buf, count);
|
||||
|
||||
update_search:
|
||||
LOG_DBG("search: buffer: %ls", term->search.buf);
|
||||
|
|
|
|||
1
search.h
1
search.h
|
|
@ -7,3 +7,4 @@ 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, uint32_t serial);
|
||||
void search_add_chars(struct terminal *term, const char *text, size_t len);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue