Skip to content

Commit

Permalink
Don't use escape codes to undo newline, just don't print it
Browse files Browse the repository at this point in the history
  • Loading branch information
IlanCosman committed Sep 20, 2023
1 parent ecb00e2 commit 2652ed7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion functions/_tide_sub_configure.fish
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,19 @@ function _tide_title -a text
set_color -o
string pad --width (math --scale=0 "$fake_columns/2" + (string length $text)/2) $text
set_color normal

set -g _tide_configure_first_option_after_title
end

function _tide_option -a symbol text
set -ga _tide_symbol_list $symbol
set -ga _tide_option_list $text

if not set -q _flag_auto
set -g _tide_configure_first_prompt_after_option

set_color -o
set -e _tide_configure_first_option_after_title || echo
echo "($symbol) $text"
set_color normal
end
Expand All @@ -85,6 +90,7 @@ function _tide_menu -a func

argparse no-restart -- $argv # Add no-restart option for first menu

echo
if not set -q _flag_no_restart
set -f r r
echo '(r) Restart from the beginning'
Expand Down Expand Up @@ -128,9 +134,11 @@ function _tide_display_prompt -a var_name var_value
set -l right_prompt_string (string pad --width (math $fake_columns-$bottom_left_prompt_string_length) $prompt[1])
set -l prompt[-1] "$prompt[-1]$right_prompt_string"

if not set -e _tide_configure_first_prompt_after_option
test "$fake_tide_prompt_add_newline_before" = true && echo
end
string unescape $prompt[2..]
set_color normal
echo
end

function _tide_exit_configure
Expand Down
3 changes: 2 additions & 1 deletion functions/tide/configure/choices/all/prompt_spacing.fish
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ function prompt_spacing
_tide_title 'Prompt Spacing'

_tide_option 1 Compact
set -g fake_tide_prompt_add_newline_before false
_tide_display_prompt
printf \e\[1A # Move cursor up 1 row
_tide_display_prompt

_tide_option 2 Sparse
set -g fake_tide_prompt_add_newline_before true
_tide_display_prompt
_tide_display_prompt

Expand Down

0 comments on commit 2652ed7

Please sign in to comment.