joshmedeski / sesh

Smart session manager for the terminal
MIT License
410 stars 16 forks source link

fix: fzf-tmux ANSI rendering example #126

Closed kristoferfannar closed 1 week ago

kristoferfannar commented 1 week ago

I've copied and used your example fzf-tmux script from your README.md (below)

bind-key "T" run-shell "sesh connect \"$(
    sesh list | fzf-tmux -p 55%,60% \
        --no-sort --border-label ' sesh ' --prompt '⚡  ' \
        --header '  ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \
        --bind 'tab:down,btab:up' \
        --bind 'ctrl-a:change-prompt(⚡  )+reload(sesh list)' \
        --bind 'ctrl-t:change-prompt(🪟  )+reload(sesh list -t)' \
        --bind 'ctrl-g:change-prompt(⚙️  )+reload(sesh list -c)' \
        --bind 'ctrl-x:change-prompt(📁  )+reload(sesh list -z)' \
        --bind 'ctrl-f:change-prompt(🔎  )+reload(fd -H -d 2 -t d -E .Trash . ~)' \
        --bind 'ctrl-d:execute(tmux kill-session -t {})+change-prompt(⚡  )+reload(sesh list)'
)\""

It's great, but I've had a problem with how the row symbols are rendered... see image below:

image

However, without piping the text from sesh to fzf-tmux, the symbols render just fine:

image

I can't see that anyone else has had this issue yet, but I've found that, contrary to gum, fzf, and therefore fzf-tmux, don't seem to support ANSI escape codes by default - at least in my case.

Therefore, passing the --ansi flag expliticly allows for fzf-tmux to correctly handle the ANSI codes. In this PR, I've simply added the flag to the README example. With the flag set, my sesh list looks like this:

image