More work on v5

This commit is contained in:
Ilan Cosman 2021-04-24 17:40:43 -07:00
parent 889c25972d
commit bf990577ed
3 changed files with 32 additions and 40 deletions

View File

@ -1,4 +1,6 @@
function _tide_left_prompt
set -g _tide_which_side_working_on left
for item in $tide_left_prompt_items
if test "$item" = newline
set_color $previousColor -b normal

View File

@ -4,22 +4,37 @@ function _tide_print_item -a item
itemColorName=tide_"$item"_color set itemColor $$colorName
itemBgColorName=tide_"$item"_bg_color set itemBgColor $$itemBgColor
if test "$tide_last_item" = newline
if test "$item" != prompt_char
set_color $itemBgColorName -b normal
printf '%s' $tide_left_prompt_prefix
if test "$_tide_which_side_working_on" = left
if test "$tide_last_item" = newline
if test "$item" != prompt_char
set_color $itemBgColorName -b normal
printf '%s' $tide_left_prompt_prefix
end
else if test "$itemBgColor" = "$tide_previous_bg_color"
set_color $tide_left_prompt_item_separator_same_color_color
printf '%s' $tide_left_prompt_item_separator_same_color
else
set_color $tide_previous_bg_color -b $itemBgColor
printf '%s' $tide_left_prompt_item_separator_diff_color
end
else if test "$itemBgColor" = "$tide_previous_bg_color"
set_color $tide_left_prompt_item_separator_same_color_color
printf '%s' $tide_left_prompt_item_separator_same_color
else
set_color $tide_previous_bg_color -b $itemBgColor
printf '%s' $tide_left_prompt_item_separator_diff_color
if test "$tide_last_item" = newline
if test "$item" != prompt_char
set_color $itemBgColorName -b normal
printf '%s' $tide_right_prompt_prefix
end
else if test "$itemBgColor" = "$tide_previous_bg_color"
set_color $tide_right_prompt_item_separator_same_color_color
printf '%s' $tide_right_prompt_item_separator_same_color
else
set_color $tide_previous_bg_color -b $itemBgColor
printf '%s' $tide_right_prompt_item_separator_diff_color
end
end
set_color $itemColor -b $itemBgColor
test "$tide_left_prompt_pad_items" = true -a "$item" != prompt_char && set -l padItem ' '
test "$tide_prompt_pad_items" = true -a "$item" != prompt_char && set -l padItem ' '
itemIconName=tide_"$item"_icon printf '%s' $padItem $$itemIconName' ' $argv[2..] $padItem
set -g tide_previous_bg_color $itemBgColor

View File

@ -1,43 +1,18 @@
function _tide_right_prompt
set -l lastItem newline
set -g _tide_which_side_working_on right
for item in $tide_right_prompt_items
if test "$item" = newline
set_color $previousColor -b normal
printf '%s' $tide_right_prompt_suffix\n
set -g tide_last_item newline
else
set -l output (_tide_item_$item)
test -n "$output" || continue
set -l colorName tide_"$item"_bg_color
set -l color $$colorName
if test "$lastItem" = newline
set_color $color -b normal
printf '%s' $tide_right_prompt_prefix
else if test "$color" = "$previousColor"
set_color $tide_right_prompt_item_separator_same_color_color
printf '%s' $tide_right_prompt_item_separator_same_color
else
set_color $color -b $previousColor
printf '%s' $tide_right_prompt_item_separator_diff_color
end
set_color -b $color
if test "$tide_right_prompt_pad_items" = true
printf '%s' " $output "
else
printf '%s' "$output"
end
set previousColor $color
_tide_item_$item
end
set lastItem $item
end
if test "$lastItem" != newline
set_color $previousColor -b normal
if test "$tide_last_item" != newline -a "$tide_last_item" != prompt_char
set_color $tide_previous_bg_color -b normal
printf '%s' $tide_right_prompt_suffix
end