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*.
This commit is contained in:
Daniel Eklöf 2020-12-05 23:29:12 +01:00
parent 5ffa65a2e3
commit b4a0f5b13b
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 70 additions and 18 deletions

View file

@ -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);
}