search: rename render.search_offset -> render.search_glyph_offset

This commit is contained in:
Daniel Eklöf 2020-01-05 15:25:24 +01:00
parent f209541688
commit 7e178d6337
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 8 additions and 8 deletions

View file

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

View file

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

View file

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