From 7e178d63374fd26da27ed9cc862b4b88443d1917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 5 Jan 2020 15:25:24 +0100 Subject: [PATCH] search: rename render.search_offset -> render.search_glyph_offset --- render.c | 12 ++++++------ search.c | 2 +- terminal.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/render.c b/render.c index 93eb1399..2ea9ed27 100644 --- a/render.c +++ b/render.c @@ -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) diff --git a/search.c b/search.c index 408c08bd..a39c75a8 100644 --- a/search.c +++ b/search.c @@ -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); diff --git a/terminal.h b/terminal.h index 287663e9..ae3ece01 100644 --- a/terminal.h +++ b/terminal.h @@ -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;