2020-05-20 20:05:33 +03:00
|
|
|
function _tide_left_prompt
|
2020-11-25 07:20:39 +03:00
|
|
|
set lastItemWasNewline
|
2020-06-25 05:45:50 +03:00
|
|
|
|
|
|
|
for item in $tide_left_prompt_items
|
|
|
|
if test "$item" = 'newline'
|
2020-11-25 07:20:39 +03:00
|
|
|
set_color $previousColor -b normal
|
|
|
|
printf '%s' $tide_left_prompt_suffix\n
|
2020-06-25 05:45:50 +03:00
|
|
|
set lastItemWasNewline
|
2020-11-25 07:20:39 +03:00
|
|
|
set alreadyOneNewline
|
|
|
|
else
|
|
|
|
set -l output (_tide_item_$item)
|
|
|
|
if test -n "$output"
|
|
|
|
set -l colorName tide_"$item"_bg_color
|
|
|
|
set -l color $$colorName
|
|
|
|
test -n "$color" || set color normal
|
|
|
|
|
|
|
|
if set -e lastItemWasNewline
|
|
|
|
if test "$tide_left_prompt_frame_enabled" = 'true'
|
|
|
|
set_color $tide_left_prompt_frame_color -b normal
|
|
|
|
if set -q alreadyOneNewline
|
|
|
|
printf '%s' '╰─'
|
|
|
|
else
|
|
|
|
printf '%s' '╭─'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if test "$item" != 'prompt_char'
|
|
|
|
set_color $color -b normal
|
|
|
|
printf '%s' $tide_left_prompt_prefix
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if test "$color" = "$previousColor"
|
|
|
|
set_color $tide_left_prompt_item_separator_same_color_color
|
|
|
|
printf '%s' $tide_left_prompt_item_separator_same_color
|
|
|
|
else
|
|
|
|
set_color $previousColor -b $color
|
|
|
|
printf '%s' $tide_left_prompt_item_separator_diff_color
|
|
|
|
end
|
|
|
|
end
|
2020-06-29 22:32:56 +03:00
|
|
|
|
2020-11-25 07:20:39 +03:00
|
|
|
set_color -b $color
|
2020-06-25 05:45:50 +03:00
|
|
|
|
2020-11-25 07:20:39 +03:00
|
|
|
if test "$tide_left_prompt_pad_items" = 'true' -a "$item" != 'prompt_char'
|
2020-12-26 19:42:21 +03:00
|
|
|
printf '%s' " $output"(set_color -b $color || echo)' ' # The set_color is for git_prompt which resets the background color
|
2020-07-04 23:47:08 +03:00
|
|
|
else
|
2020-11-25 07:20:39 +03:00
|
|
|
printf '%s' "$output"
|
2020-07-04 23:47:08 +03:00
|
|
|
end
|
2020-06-27 00:59:35 +03:00
|
|
|
|
2020-11-25 07:20:39 +03:00
|
|
|
set previousColor $color
|
2020-07-04 23:47:08 +03:00
|
|
|
|
2020-11-25 07:20:39 +03:00
|
|
|
test "$item" = 'prompt_char' && set lastItemWasPromptChar
|
2020-07-04 23:47:08 +03:00
|
|
|
end
|
2020-06-30 05:54:59 +03:00
|
|
|
end
|
2020-05-20 20:05:33 +03:00
|
|
|
end
|
2020-06-30 21:49:37 +03:00
|
|
|
|
|
|
|
if set -q lastItemWasNewline && test "$tide_left_prompt_frame_enabled" = 'true'
|
2020-07-04 23:47:08 +03:00
|
|
|
set_color $tide_left_prompt_frame_color -b normal
|
2020-11-25 07:20:39 +03:00
|
|
|
printf '%s' '╰─'
|
2020-11-28 22:26:57 +03:00
|
|
|
else if not set -q lastItemWasPromptChar
|
|
|
|
set_color $previousColor -b normal
|
|
|
|
printf '%s' $tide_left_prompt_suffix
|
2020-06-30 21:49:37 +03:00
|
|
|
end
|
2020-05-20 20:05:33 +03:00
|
|
|
end
|