fzy

terminal fuzzy finder picker

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

commit d43c9b2b02b2d46ed1d9dac462f6740c2982e269
parent 367350794abb3abe239b11031496002eb7b19152
Author: Jul <jul@9o.is>
Date:   Tue, 24 Feb 2026 05:15:49 +0800

handle custom escape sequence to hide text from display

Diffstat:
Msrc/tty_interface.c | 21++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/tty_interface.c b/src/tty_interface.c @@ -61,6 +61,7 @@ static void draw_match(tty_interface_t *state, const char *choice, int selected) #endif 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, "..."); @@ -76,13 +77,31 @@ static void draw_match(tty_interface_t *state, const char *choice, int selected) if (!options->no_color) tty_setfg(tty, TTY_COLOR_NORMAL); } + + 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; + } + if (choice[i] == '\n') { tty_putc(tty, ' '); } else if (choice[i] == '\t') { tty_printf(tty, " "); woffset += 3; } else { - tty_printf(tty, "%c", choice[i]); + tty_putc(tty, choice[i]); } } tty_setwrap(tty);