diff --git a/CHANGELOG.md b/CHANGELOG.md index a2478871..45b13ee9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,9 @@ CHANGELOG - fzf now opens in a tmux or Zellij floating pane by default, so the window it was started from stays visible and can be used while fzf is running - Requires tmux 3.7+ or Zellij 0.44+ - Set `g:fzf_layout` to pick a different layout -- fish: Fixed custom CTRL-T command not using the prefixed target directory in some cases (#4498) +- fish: + - Fixed custom CTRL-T command not using the prefixed target directory in some cases (#4498) + - Optimized description alignment of completion items (#4910) 0.74.3 ------ diff --git a/shell/completion.fish b/shell/completion.fish index ca7dec4a..6c5d17e7 100644 --- a/shell/completion.fish +++ b/shell/completion.fish @@ -124,10 +124,8 @@ function fzf_complete -w fzf -d 'fzf command completion and wildcard expansion s # Determine the tabstop length for description alignment set -l -- max_columns (math $COLUMNS - 40) - for i in $list[1..500] - set -l -- item (string split -f 1 -- \t $i) - and set -l -- len (string length -V -- $item) - and test "$len" -gt "$tabstop" -a "$len" -lt "$max_columns" + for len in (string match -r -- '^[^\\t]*(?=\\t)' $list[1..500] | string length -V) + test "$len" -gt "$tabstop" -a "$len" -lt "$max_columns" and set -- tabstop $len end set -- tabstop (math $tabstop + 4)