diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-12-05 22:29:12 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-12-07 19:44:13 +0000 |
| commit | b4a0f5b13b44525bd1dbdbc12e4e412fc9a0a1cb (patch) | |
| tree | 09ed7a541b32cf190ba746b0e4d3f342defbfe92 /search.c | |
| parent | render: search: wcsnlen() -> wcswidth() (diff) | |
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*.
Diffstat (limited to 'search.c')
| -rw-r--r-- | search.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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); } |
