Fix right prompt frame bug

This commit is contained in:
Ilan Cosman 2022-01-08 14:05:44 -08:00
parent adb6f33bfe
commit 70ac8f1195

View File

@ -18,7 +18,7 @@ function _tide_refresh_prompt --on-variable $prompt_var
commandline -f repaint
end
if contains newline $_tide_left_items
if contains newline $_tide_left_items # two line prompt initialization
test "$tide_prompt_add_newline_before" = true && set -l add_newline '\n'
set_color $tide_prompt_color_frame_and_connection -b normal | read -l prompt_and_framce_color
@ -48,11 +48,15 @@ CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_ti
math \$COLUMNS-(string length --visible \"\$$prompt_var[1][2]\$$prompt_var[1][3]\")+$column_offset | read -lx dist_btwn_sides
echo -ns $add_newline(string replace @PWD@ (_tide_pwd) \"$top_left_frame\$$prompt_var[1][2]\")'$prompt_and_framce_color'
echo -ns $add_newline'$top_left_frame'(string replace @PWD@ (_tide_pwd) \"\$$prompt_var[1][2]\")'$prompt_and_framce_color'
string repeat --no-newline --max (math max 0, \$dist_btwn_sides-\$pwd_length) '$tide_prompt_icon_connection'
echo -ns \"\$$prompt_var[1][3]$top_right_frame\"\n\"$bot_left_frame\$$prompt_var[1][4] \"
end
function fish_right_prompt
string unescape \"\$$prompt_var[1][1]$bot_right_frame\"
end"
else
else # one line prompt initialization
test "$tide_prompt_add_newline_before" = true && set -l add_newline '\0'
math 5 -$tide_prompt_min_cols | read -l column_offset
@ -72,14 +76,13 @@ CMD_DURATION=\$CMD_DURATION fish_bind_mode=\$fish_bind_mode set $prompt_var (_ti
math \$COLUMNS-(string length --visible \"\$$prompt_var[1][2]\$$prompt_var[1][3]\")$column_offset | read -lx dist_btwn_sides
string replace @PWD@ (_tide_pwd) $add_newline \$$prompt_var[1][2]' '
end
function fish_right_prompt
string unescape \$$prompt_var[1][1]
end"
end
eval "
function fish_right_prompt
string unescape \$$prompt_var[1][1]$bot_right_frame
end
function _tide_on_fish_exit --on-event fish_exit
eval "function _tide_on_fish_exit --on-event fish_exit
set -e $prompt_var
end"