mirror of
https://github.com/IlanCosman/tide.git
synced 2024-12-23 20:13:05 +03:00
41 lines
1.1 KiB
Fish
41 lines
1.1 KiB
Fish
function tide_right_prompt
|
|
set -l splitText (string split '\n' (_fetch_right_prompt_items))
|
|
set -l printAtEndedRightPromptHeight (count $splitText)
|
|
|
|
for thing in $splitText[1..-2]
|
|
_print_at_end $thing
|
|
end
|
|
if test $printAtEndedRightPromptHeight -eq $tide_left_prompt_height
|
|
set -g tide_right_prompt_fish $splitText[-1]
|
|
set printAtEndedRightPromptHeight (math $printAtEndedRightPromptHeight-1)
|
|
else
|
|
_print_at_end $splitText[-1]
|
|
set -g tide_right_prompt_fish ''
|
|
end
|
|
|
|
_cursor_up $printAtEndedRightPromptHeight
|
|
end
|
|
|
|
function fish_right_prompt
|
|
printf '%s' $tide_right_prompt_fish
|
|
end
|
|
|
|
function _fetch_right_prompt_items
|
|
printf '%s' ' '
|
|
|
|
for item in tide_{$tide_right_prompt_items}
|
|
set -l itemOutput (_$item)
|
|
printf '%s' "$itemOutput"
|
|
|
|
set_color normal
|
|
end
|
|
end
|
|
|
|
function _print_at_end -a text
|
|
set -l startLocation (math $COLUMNS -(string length (tide_decolor $text)))
|
|
_cursor_right $startLocation
|
|
printf '%s' $text
|
|
|
|
printf '%b' '\v'
|
|
printf '%b' '\r'
|
|
end |