2020-05-20 20:05:33 +03:00
|
|
|
function _tide_right_prompt
|
2021-03-04 22:06:17 +03:00
|
|
|
set -l lastItem newline
|
2020-06-26 22:02:40 +03:00
|
|
|
|
|
|
|
for item in $tide_right_prompt_items
|
2021-03-02 20:46:40 +03:00
|
|
|
if test "$item" = newline
|
2020-11-25 07:41:24 +03:00
|
|
|
set_color $previousColor -b normal
|
|
|
|
printf '%s' $tide_right_prompt_suffix\n
|
|
|
|
else
|
|
|
|
set -l output (_tide_item_$item)
|
2021-03-04 22:06:17 +03:00
|
|
|
test -n "$output" || continue
|
2020-11-25 07:41:24 +03:00
|
|
|
|
2021-03-04 22:06:17 +03:00
|
|
|
set -l colorName tide_"$item"_bg_color
|
|
|
|
set -l color $$colorName
|
2020-06-26 22:02:40 +03:00
|
|
|
|
2021-03-04 22:06:17 +03:00
|
|
|
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
|
2020-04-29 01:43:22 +03:00
|
|
|
|
2021-03-04 22:06:17 +03:00
|
|
|
set_color -b $color
|
2020-06-26 22:02:40 +03:00
|
|
|
|
2021-03-04 22:06:17 +03:00
|
|
|
if test "$tide_right_prompt_pad_items" = true
|
|
|
|
printf '%s' " $output "
|
|
|
|
else
|
|
|
|
printf '%s' "$output"
|
2020-06-26 22:02:40 +03:00
|
|
|
end
|
2021-03-04 22:06:17 +03:00
|
|
|
|
|
|
|
set previousColor $color
|
2020-06-26 22:02:40 +03:00
|
|
|
end
|
2021-03-04 22:06:17 +03:00
|
|
|
set lastItem $item
|
2020-05-09 01:32:58 +03:00
|
|
|
end
|
2020-06-26 22:02:40 +03:00
|
|
|
|
2021-03-04 22:06:17 +03:00
|
|
|
if test "$lastItem" != newline
|
2020-07-05 21:34:01 +03:00
|
|
|
set_color $previousColor -b normal
|
|
|
|
printf '%s' $tide_right_prompt_suffix
|
|
|
|
end
|
2021-03-17 19:49:05 +03:00
|
|
|
|
|
|
|
set_color normal # Make sure there is something printed on the last line
|
2020-05-15 07:53:37 +03:00
|
|
|
end
|