Separator will not display after prompt_char

This commit is contained in:
Ilan Cosman 2020-06-25 19:02:20 -07:00
parent a85d4cd6d1
commit c9f6939192

View File

@ -4,7 +4,10 @@ function _tide_left_prompt
for item in $tide_left_prompt_items
if test "$item" = 'newline'
_print_separator
if not set -q lastItemWasNewline && not set -q dontDisplayNextSeparator
set color normal
_print_separator
end
printf '%b' '\n'
set lastItemWasNewline
@ -21,18 +24,26 @@ function _tide_left_prompt
set_color -b $color
if set -q lastItemWasNewline
printf '%s' $tide_left_prompt_prefix
if test "$item" != 'prompt_char'
printf '%s' $tide_left_prompt_prefix
end
set -e lastItemWasNewline
else if set -q dontDisplayNextSeparator
set -e dontDisplayNextSeparator
else
_print_separator
end
printf '%b' $output
set previousColor $color
if test "$item" = 'prompt_char'
set dontDisplayNextSeparator
end
end
end
if not set -q lastItemWasNewline
if not set -q lastItemWasNewline && not set -q dontDisplayNextSeparator
set color normal
_print_separator
end
@ -42,21 +53,18 @@ end
function _print_separator --no-scope-shadowing
if test "$color" = "$previousColor"
switch $tide_left_prompt_item_separator
case ''
case ' '
printf '%s' ' '
case '*'
printf '%s' ' '$tide_left_prompt_item_separator' '
if test "$tide_left_prompt_pad_separators" = 'true'
printf '%s' ' '$tide_left_prompt_item_separator' '
else
printf '%s' $tide_left_prompt_item_separator
end
else
switch $tide_left_prompt_item_separator_diff_color
case ''
case ' '
printf '%s' ' '
case '*'
set_color -b $previousColor 2>/dev/null # Piping errors to null is necessary for newline at the start of prompt items
printf '%s' ' '(set_color -b $color)(set_color $previousColor)$tide_left_prompt_item_separator_diff_color' '
set_color -b $previousColor 2>/dev/null #Neccesary for first item newline
if test "$tide_left_prompt_pad_separators" = 'true'
printf '%s' ' '(set_color -b $color $previousColor)$tide_left_prompt_item_separator_diff_color' '
else
printf '%s' (set_color -b $color $previousColor)$tide_left_prompt_item_separator_diff_color
end
end
end