From 70ac8f1195a88382dc725ef8c11183054d9d808e Mon Sep 17 00:00:00 2001 From: Ilan Cosman Date: Sat, 8 Jan 2022 14:05:44 -0800 Subject: [PATCH] Fix right prompt frame bug --- functions/fish_prompt.fish | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 9d5b750..2b3f1b4 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -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"