mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-25 06:46:36 -04:00
render: search: fix off-by-one error in number of visible characters
This commit is contained in:
parent
601dc02ea1
commit
f67572208d
1 changed files with 2 additions and 2 deletions
4
render.c
4
render.c
|
|
@ -1119,7 +1119,7 @@ render_search_box(struct terminal *term)
|
||||||
pixman_color_t fg = color_hex_to_pixman(term->colors.table[0]);
|
pixman_color_t fg = color_hex_to_pixman(term->colors.table[0]);
|
||||||
|
|
||||||
if (term->search.cursor < glyph_offset ||
|
if (term->search.cursor < glyph_offset ||
|
||||||
term->search.cursor >= glyph_offset + visible_chars + 2)
|
term->search.cursor >= glyph_offset + visible_chars + 1)
|
||||||
{
|
{
|
||||||
/* Make sure cursor is always visible */
|
/* Make sure cursor is always visible */
|
||||||
term->render.search_glyph_offset = glyph_offset = term->search.cursor;
|
term->render.search_glyph_offset = glyph_offset = term->search.cursor;
|
||||||
|
|
@ -1127,7 +1127,7 @@ render_search_box(struct terminal *term)
|
||||||
|
|
||||||
/* Text (what the user entered - *not* match(es)) */
|
/* Text (what the user entered - *not* match(es)) */
|
||||||
for (size_t i = glyph_offset;
|
for (size_t i = glyph_offset;
|
||||||
i < term->search.len && i - glyph_offset < visible_chars + 1;
|
i < term->search.len && i - glyph_offset < visible_chars;
|
||||||
i++)
|
i++)
|
||||||
{
|
{
|
||||||
if (i == term->search.cursor)
|
if (i == term->search.cursor)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue