fzy

terminal fuzzy finder picker

git clone https://9o.is/git/fzy.git

commit 663f4e811f1a275b262a74b1c1d0d91aefa0ea98
parent d43c9b2b02b2d46ed1d9dac462f6740c2982e269
Author: Jul <jul@9o.is>
Date:   Tue, 24 Feb 2026 23:19:30 +0800

remove woffset and "..."

Diffstat:
Msrc/tty_interface.c | 12++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/tty_interface.c b/src/tty_interface.c @@ -35,7 +35,6 @@ static void draw_match(tty_interface_t *state, const char *choice, int selected) options_t *options = state->options; char *search = state->last_search; unsigned int width = tty_getwidth(tty); - unsigned int woffset = 3; size_t len = strlen(choice); int n = strlen(search); @@ -62,9 +61,8 @@ static void draw_match(tty_interface_t *state, const char *choice, int selected) tty_setnowrap(tty); unsigned char display = 1; - for (size_t i = 0, p = 0; choice[i] != '\0'; i++) { - if (i >= width - woffset && len > width) { - tty_printf(tty, "..."); + for (size_t i = 0, j = 0, p = 0; choice[i] != '\0'; i++) { + if (j >= width && len > width) { break; } if (positions[p] == i) { @@ -80,18 +78,15 @@ static void draw_match(tty_interface_t *state, const char *choice, int selected) if (strncmp(choice + i, "\x1b[?9000a", 8) == 0) { i += 7; - woffset -= 8; display = 0; continue; } else if (strncmp(choice + i, "\x1b[?9000b", 8) == 0) { i += 7; - woffset -= 8; display = 1; continue; } if (!display) { - woffset -= 1; continue; } @@ -99,10 +94,11 @@ static void draw_match(tty_interface_t *state, const char *choice, int selected) tty_putc(tty, ' '); } else if (choice[i] == '\t') { tty_printf(tty, " "); - woffset += 3; + j += 3; } else { tty_putc(tty, choice[i]); } + j++; } tty_setwrap(tty); tty_setnormal(tty);