From b4a0f5b13b44525bd1dbdbc12e4e412fc9a0a1cb Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 5 Dec 2020 23:29:12 +0100 Subject: render: search: glyph_offset is in *cells*, cursor position in *characters* When calculating the offset into the search string, from where to start rendering, take into account that the cursor position is in *characters*, and the glyph-offset is in *cells*. --- search.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'search.c') diff --git a/search.c b/search.c index a9f5499a..83f86390 100644 --- a/search.c +++ b/search.c @@ -18,6 +18,7 @@ #include "selection.h" #include "shm.h" #include "util.h" +#include "xmalloc.h" /* * Ensures a "new" viewport doesn't contain any unallocated rows. @@ -124,6 +125,11 @@ search_begin(struct terminal *term) term->search.view_followed_offset = term->grid->view == term->grid->offset; term->is_searching = true; + term->search.len = 0; + term->search.sz = 64; + term->search.buf = xmalloc(term->search.sz * sizeof(term->search.buf[0])); + term->search.buf[0] = L'\0'; + term_xcursor_update(term); render_refresh_search(term); } -- cgit v1.3