fzy

terminal fuzzy finder picker

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

commit ade260ab7133bec7945ec785025d694090f20a5f
parent 8c362f91162affd464d5ff060f676f9e00a3e5c5
Author: John Hawthorn <john@hawthorn.email>
Date:   Sat, 21 Jul 2018 15:50:23 -0700

Merge pull request #88 from MichaelMackus/selection-underline

Add support for underlining selected item
Diffstat:
Msrc/tty.c | 4++++
Msrc/tty.h | 1+
Msrc/tty_interface.c | 4++++
3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/tty.c b/src/tty.c @@ -110,6 +110,10 @@ void tty_setinvert(tty_t *tty) { tty_sgr(tty, 7); } +void tty_setunderline(tty_t *tty) { + tty_sgr(tty, 4); +} + void tty_setnormal(tty_t *tty) { tty_sgr(tty, 0); tty->fgcolor = 9; diff --git a/src/tty.h b/src/tty.h @@ -21,6 +21,7 @@ int tty_input_ready(tty_t *tty); void tty_setfg(tty_t *tty, int fg); void tty_setinvert(tty_t *tty); +void tty_setunderline(tty_t *tty); void tty_setnormal(tty_t *tty); #define TTY_COLOR_BLACK 0 diff --git a/src/tty_interface.c b/src/tty_interface.c @@ -46,7 +46,11 @@ static void draw_match(tty_interface_t *state, const char *choice, int selected) } if (selected) +#ifdef TTY_SELECTION_UNDERLINE + tty_setunderline(tty); +#else tty_setinvert(tty); +#endif for (size_t i = 0, p = 0; choice[i] != '\0'; i++) { if (i + 1 < maxwidth) {