tide/functions/_tide_right_prompt.fish

36 lines
1009 B
Fish
Raw Normal View History

2020-05-20 20:05:33 +03:00
function _tide_right_prompt
set -l splitText (_fetch_right_prompt_items | string split '\n')
2020-05-18 19:44:33 +03:00
set -l printAtEndedRightPromptHeight (count $splitText)
2020-05-17 07:43:27 +03:00
2020-05-15 07:53:37 +03:00
for thing in $splitText[1..-2]
_print_at_end $thing
end
2020-05-20 20:39:44 +03:00
if test $printAtEndedRightPromptHeight -eq $_tide_left_prompt_height
set -g _tide_right_prompt_fish $splitText[-1]
2020-05-18 19:44:33 +03:00
set printAtEndedRightPromptHeight (math $printAtEndedRightPromptHeight-1)
2020-05-15 07:53:37 +03:00
else
_print_at_end $splitText[-1]
2020-05-20 20:39:44 +03:00
set -g _tide_right_prompt_fish ''
2020-05-15 07:53:37 +03:00
end
2020-05-17 07:43:27 +03:00
2020-05-18 19:44:33 +03:00
_cursor_up $printAtEndedRightPromptHeight
2020-05-15 07:53:37 +03:00
end
function fish_right_prompt
2020-05-20 20:39:44 +03:00
printf '%s' $_tide_right_prompt_fish
2020-05-15 07:53:37 +03:00
end
function _fetch_right_prompt_items
2020-05-18 20:06:02 +03:00
printf '%s' ' '
2020-05-20 20:05:33 +03:00
for item in _tide_item_{$tide_right_prompt_items}
2020-06-08 06:14:15 +03:00
printf '%s' ($item)$_tide_color_normal
2020-05-09 01:32:58 +03:00
end
2020-05-15 07:53:37 +03:00
end
function _print_at_end -a text
set -l startLocation (math $COLUMNS -(_tide_decolor $text | string length))
2020-05-18 19:44:33 +03:00
_cursor_right $startLocation
2020-06-10 19:18:15 +03:00
printf '%s%b' $text '\v\r'
2020-04-21 21:52:24 +03:00
end