diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-01-05 14:25:24 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-01-05 14:25:24 +0000 |
| commit | 7e178d63374fd26da27ed9cc862b4b88443d1917 (patch) | |
| tree | c620ac0b5ef3138b0a3c930136aaa355aa9f0a71 | |
| parent | Merge branch 'search-render-improvements' (diff) | |
search: rename render.search_offset -> render.search_glyph_offset
| -rw-r--r-- | render.c | 12 | ||||
| -rw-r--r-- | search.c | 2 | ||||
| -rw-r--r-- | terminal.h | 2 |
3 files changed, 8 insertions, 8 deletions
@@ -899,6 +899,7 @@ render_search_box(struct terminal *term) 2 * margin + 1 * term->cell_height); const size_t visible_chars = (width - 2 * margin) / term->cell_width; + size_t glyph_offset = term->render.search_glyph_offset; unsigned long cookie = (uintptr_t)term + 1; struct buffer *buf = shm_get_buffer(term->wl->shm, width, height, cookie); @@ -917,17 +918,16 @@ render_search_box(struct terminal *term) int y = margin; pixman_color_t fg = color_hex_to_pixman(term->colors.table[0]); - if (term->search.cursor < term->render.search_offset || - term->search.cursor >= term->render.search_offset + visible_chars + 2) + if (term->search.cursor < glyph_offset || + term->search.cursor >= glyph_offset + visible_chars + 2) { /* Make sure cursor is always visible */ - term->render.search_offset = term->search.cursor; + term->render.search_glyph_offset = glyph_offset = term->search.cursor; } /* Text (what the user entered - *not* match(es)) */ - for (size_t i = term->render.search_offset; - i < term->search.len && - i - term->render.search_offset < visible_chars + 1; + for (size_t i = glyph_offset; + i < term->search.len && i - glyph_offset < visible_chars + 1; i++) { if (i == term->search.cursor) @@ -51,7 +51,7 @@ search_cancel_keep_selection(struct terminal *term) term->search.match = (struct coord){-1, -1}; term->search.match_len = 0; term->is_searching = false; - term->render.search_offset = 0; + term->render.search_glyph_offset = 0; term_xcursor_update(term); render_refresh(term); @@ -310,7 +310,7 @@ struct terminal { bool was_flashing; /* Flash was active last time we rendered */ bool was_searching; - size_t search_offset; + size_t search_glyph_offset; bool presentation_timings; struct timespec input_time; |
