Add right prompt frame

This commit is contained in:
Ilan Cosman 2020-06-29 19:54:59 -07:00
parent 3a75a22aff
commit 189638cb46
2 changed files with 24 additions and 5 deletions

View File

@ -60,12 +60,17 @@ function _tide_left_prompt
end
end
if not set -q lastItemWasNewline && not set -q dontDisplayNextSeparator
if set -q lastItemWasNewline
if test "$tide_left_prompt_frame_enabled" = 'true'
set_color $tide_left_prompt_frame_color
printf '%s' '╰─'
end
set_color normal # Prompt won't display a newline at the end without something printed on it
else if not set -q lastItemWasNewline && not set -q dontDisplayNextSeparator
set color normal
_print_left_prompt_separator
end
set_color normal # Prompt won't display a newline at the end without something printed on it
end
function _print_left_prompt_separator --no-scope-shadowing

View File

@ -2,9 +2,23 @@ function _tide_right_prompt
set -l splitText (_fetch_right_prompt_items | string split '\n')
set -l printAtEndedRightPromptHeight (count $splitText)
for thing in $splitText[1..-2]
_print_at_end $thing
if test "$tide_right_prompt_frame_enabled" = 'true'
set -l frameColor (set_color $tide_right_prompt_frame_color -b normal)
if test $printAtEndedRightPromptHeight -gt 1
set splitText[1] $splitText[1]$frameColor'─╮'
set splitText[-1] $splitText[-1]$frameColor'─╯'
if test $printAtEndedRightPromptHeight -gt 2
set splitText[2..-2] $splitText[2..-2]$frameColor'─┤'
end
end
end
for lineOfText in $splitText[1..-2]
_print_at_end $lineOfText
end
if test $printAtEndedRightPromptHeight -eq $_tide_left_prompt_height
set -g _tide_right_prompt_fish $splitText[-1]
set printAtEndedRightPromptHeight (math $printAtEndedRightPromptHeight-1)