Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/-ftb-fzf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ local ret=0
}

local -a _active_style_lower=(${(L)active_group_style})
local -a _active_style_valid=(${(M)_active_style_lower:#(bold|underline|none)})
local -a _active_style_valid=(${(M)_active_style_lower:#(bold|underline|reverse|none)})
local -a _active_style_sorted=(${(ou)_active_style_valid})
local normalized_active_group_style=${${(j:,:)_active_style_sorted}:-none}

Expand Down
39 changes: 31 additions & 8 deletions lib/ftb-switch-group
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,37 @@ fi
echo $current > $tmp_dir/current-group.$pid

# configure style of active header
local sgr_on='' sgr_off=''
case $active_group_style in
(bold) sgr_on=$'\x1b[1m'; sgr_off=$'\x1b[22m' ;;
(underline) sgr_on=$'\x1b[4m'; sgr_off=$'\x1b[24m' ;;
(bold,underline) sgr_on=$'\x1b[1;4m'; sgr_off=$'\x1b[22;24m' ;;
(none) sgr_on=''; sgr_off='' ;;
(*) sgr_on=$'\x1b[1m'; sgr_off=$'\x1b[22m' ;; # fallback
esac
local sgr_on='' sgr_off='' style
local -a active_style_tokens sgr_on_codes sgr_off_codes
active_style_tokens=(${(s:,:)active_group_style})

if (( ${active_style_tokens[(I)none]} )); then
active_style_tokens=(none)
fi

for style in $active_style_tokens; do
case $style in
(bold)
sgr_on_codes+=(1)
sgr_off_codes+=(22)
;;
(underline)
sgr_on_codes+=(4)
sgr_off_codes+=(24)
;;
(reverse)
sgr_on_codes+=(7)
sgr_off_codes+=(27)
;;
(none)
;;
esac
done

if (( $#sgr_on_codes )); then
sgr_on=$'\x1b['${(j:;:)sgr_on_codes}$'m'
sgr_off=$'\x1b['${(j:;:)sgr_off_codes}$'m'
fi

# The ANSI SGR code that marks every line in the currently selected group.
local current_prefix=$group_sgr_prefixes[current]
Expand Down