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 for item in $tide_left_prompt_items
if test "$item" = 'newline' if test "$item" = 'newline'
_print_separator if not set -q lastItemWasNewline && not set -q dontDisplayNextSeparator
set color normal
_print_separator
end
printf '%b' '\n' printf '%b' '\n'
set lastItemWasNewline set lastItemWasNewline
@ -21,18 +24,26 @@ function _tide_left_prompt
set_color -b $color set_color -b $color
if set -q lastItemWasNewline 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 set -e lastItemWasNewline
else if set -q dontDisplayNextSeparator
set -e dontDisplayNextSeparator
else else
_print_separator _print_separator
end end
printf '%b' $output printf '%b' $output
set previousColor $color set previousColor $color
if test "$item" = 'prompt_char'
set dontDisplayNextSeparator
end
end end
end end
if not set -q lastItemWasNewline if not set -q lastItemWasNewline && not set -q dontDisplayNextSeparator
set color normal set color normal
_print_separator _print_separator
end end
@ -42,21 +53,18 @@ end
function _print_separator --no-scope-shadowing function _print_separator --no-scope-shadowing
if test "$color" = "$previousColor" if test "$color" = "$previousColor"
switch $tide_left_prompt_item_separator if test "$tide_left_prompt_pad_separators" = 'true'
case '' printf '%s' ' '$tide_left_prompt_item_separator' '
case ' ' else
printf '%s' ' ' printf '%s' $tide_left_prompt_item_separator
case '*'
printf '%s' ' '$tide_left_prompt_item_separator' '
end end
else else
switch $tide_left_prompt_item_separator_diff_color set_color -b $previousColor 2>/dev/null #Neccesary for first item newline
case ''
case ' ' if test "$tide_left_prompt_pad_separators" = 'true'
printf '%s' ' ' printf '%s' ' '(set_color -b $color $previousColor)$tide_left_prompt_item_separator_diff_color' '
case '*' else
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 $previousColor)$tide_left_prompt_item_separator_diff_color
printf '%s' ' '(set_color -b $color)(set_color $previousColor)$tide_left_prompt_item_separator_diff_color' '
end end
end end
end end