mirror of
https://github.com/IlanCosman/tide.git
synced 2024-12-23 12:03:48 +03:00
Partially fix wizard
This commit is contained in:
parent
230821a99f
commit
9f6a4e108b
@ -81,7 +81,7 @@ end
|
||||
|
||||
function _tide_display_prompt -a var_name var_value
|
||||
test -n "$var_name" && set -g $var_name $var_value
|
||||
fake_prompt
|
||||
_fake_tide_prompt
|
||||
printf '\n\n'
|
||||
end
|
||||
|
||||
|
@ -1,47 +0,0 @@
|
||||
function _fake_tide_left_prompt
|
||||
set -l lastItem newline
|
||||
|
||||
for item in $fake_tide_left_prompt_items
|
||||
if test "$item" = newline
|
||||
set_color $previousColor -b normal
|
||||
printf '%s' $fake_tide_left_prompt_suffix\n
|
||||
else
|
||||
set -l output (_fake_tide_item_$item)
|
||||
test -n "$output" || continue
|
||||
|
||||
set -l colorName fake_tide_"$item"_bg_color
|
||||
set -l color $$colorName
|
||||
|
||||
if test "$lastItem" = newline
|
||||
if test "$item" != character
|
||||
set_color $color -b normal
|
||||
printf '%s' $fake_tide_left_prompt_prefix
|
||||
end
|
||||
else if test "$color" = "$previousColor"
|
||||
set_color $fake_tide_prompt_color_separator_same_color
|
||||
printf '%s' $fake_tide_left_prompt_separator_same_color
|
||||
else
|
||||
set_color $previousColor -b $color
|
||||
printf '%s' $fake_tide_left_prompt_separator_diff_color
|
||||
end
|
||||
|
||||
set_color -b $color
|
||||
|
||||
if test "$fake_tide_prompt_pad_items" = true -a "$item" != character
|
||||
printf '%s' " $output "
|
||||
else
|
||||
printf '%s' "$output"
|
||||
end
|
||||
|
||||
set previousColor $color
|
||||
end
|
||||
set lastItem $item
|
||||
end
|
||||
|
||||
if test "$lastItem" != newline -a "$lastItem" != character
|
||||
set_color $previousColor -b normal
|
||||
printf '%s' $fake_tide_left_prompt_suffix
|
||||
end
|
||||
|
||||
set_color normal
|
||||
end
|
@ -0,0 +1,38 @@
|
||||
function _fake_tide_print_item -a item
|
||||
item_bg_color_name=fake_tide_"$item"_bg_color set item_bg_color $$item_bg_color_name
|
||||
|
||||
if test "$_fake_tide_which_side_working_on" = left
|
||||
if test "$_fake_tide_last_item" = newline
|
||||
if test "$item" != character
|
||||
set_color $item_bg_color -b normal
|
||||
printf '%s' $fake_tide_left_prompt_prefix
|
||||
end
|
||||
else if test "$item_bg_color" = "$_fake_tide_previous_bg_color"
|
||||
set_color $fake_tide_prompt_color_separator_same_color
|
||||
printf '%s' $fake_tide_left_prompt_separator_same_color
|
||||
else
|
||||
set_color $_fake_tide_previous_bg_color -b $item_bg_color
|
||||
printf '%s' $fake_tide_left_prompt_separator_diff_color
|
||||
end
|
||||
else if test "$_fake_tide_last_item" = newline
|
||||
set_color $item_bg_color -b normal
|
||||
printf '%s' $fake_tide_right_prompt_prefix
|
||||
else if test "$item_bg_color" = "$_fake_tide_previous_bg_color"
|
||||
set_color $fake_tide_prompt_color_separator_same_color
|
||||
printf '%s' $fake_tide_right_prompt_separator_same_color
|
||||
else
|
||||
set_color $item_bg_color -b $_fake_tide_previous_bg_color
|
||||
printf '%s' $fake_tide_right_prompt_separator_diff_color
|
||||
end
|
||||
|
||||
item_color_name=fake_tide_"$item"_color set_color $$item_color_name -b $item_bg_color
|
||||
|
||||
if test "$fake_tide_prompt_pad_items" = true -a "$item" != character
|
||||
printf '%s' ' ' $argv[2..] ' '
|
||||
else
|
||||
printf '%s' $argv[2..]
|
||||
end
|
||||
|
||||
set -g _fake_tide_previous_bg_color $item_bg_color
|
||||
set -g _fake_tide_last_item $item
|
||||
end
|
65
functions/tide/configure/functions/_fake_tide_prompt.fish
Normal file
65
functions/tide/configure/functions/_fake_tide_prompt.fish
Normal file
@ -0,0 +1,65 @@
|
||||
function _fake_tide_prompt
|
||||
# Variables are exported as strings, convert _fake_tide_last_pipestatus back into a list
|
||||
set -g _fake_tide_last_pipestatus (string split ' ' $_fake_tide_last_pipestatus)
|
||||
|
||||
test "$fake_tide_prompt_add_newline_before" = true && echo
|
||||
|
||||
left_prompt=(_fake_tide_left_prompt) right_prompt=(_fake_tide_right_prompt) if set -q left_prompt[2] # If prompt is two lines
|
||||
set -l prompt_and_frame_color (set_color $fake_tide_prompt_color_frame_and_connection -b normal || echo)
|
||||
|
||||
if test "$fake_tide_left_prompt_frame_enabled" = true
|
||||
set left_prompt[1] $prompt_and_frame_color╭─"$left_prompt[1]"
|
||||
set left_prompt[2] $prompt_and_frame_color╰─"$left_prompt[2]"
|
||||
end
|
||||
if test "$fake_tide_right_prompt_frame_enabled" = true
|
||||
set right_prompt[1] "$right_prompt[1]"$prompt_and_frame_color─╮
|
||||
set right_prompt[2] "$right_prompt[2]"$prompt_and_frame_color─╯
|
||||
end
|
||||
|
||||
printf '%s' $left_prompt[1] $prompt_and_frame_color
|
||||
|
||||
set -l length_to_move (math $fake_columns - ( # Regex removes color codes
|
||||
string replace -ar '\e(\[[\d;]*|\(B\e\[)m(\co)?' '' "$left_prompt[1]""$right_prompt[1]" | string length))
|
||||
test $length_to_move -gt 0 && string repeat --no-newline --max $length_to_move $fake_tide_prompt_icon_connection
|
||||
|
||||
printf '%s' $right_prompt[1] \n $left_prompt[-1]' '
|
||||
else
|
||||
printf '%s' $left_prompt[-1]' '
|
||||
printf '%s' 'h'
|
||||
printf '%s' $right_prompt[1]
|
||||
end
|
||||
|
||||
set_color normal
|
||||
end
|
||||
|
||||
function _fake_tide_left_prompt
|
||||
set -g _fake_tide_last_item newline
|
||||
set -g _fake_tide_which_side_working_on left
|
||||
|
||||
for item in $fake_tide_left_prompt_items
|
||||
_fake_tide_item_$item
|
||||
end
|
||||
|
||||
if not contains -- $_fake_tide_last_item newline character
|
||||
set_color $_fake_tide_previous_bg_color -b normal
|
||||
printf '%s' $fake_tide_left_prompt_suffix
|
||||
end
|
||||
|
||||
set_color normal # Make sure there is something printed on the last line
|
||||
end
|
||||
|
||||
function _fake_tide_right_prompt
|
||||
set -g _fake_tide_last_item newline
|
||||
set -g _fake_tide_which_side_working_on right
|
||||
|
||||
for item in $fake_tide_right_prompt_items
|
||||
_fake_tide_item_$item
|
||||
end
|
||||
|
||||
if test "$_fake_tide_last_item" != newline
|
||||
set_color $_fake_tide_previous_bg_color -b normal
|
||||
printf '%s' $fake_tide_right_prompt_suffix
|
||||
end
|
||||
|
||||
set_color normal # Make sure there is something printed on the last line
|
||||
end
|
@ -1,42 +0,0 @@
|
||||
function _fake_tide_right_prompt
|
||||
set -l lastItem newline
|
||||
|
||||
for item in $fake_tide_right_prompt_items
|
||||
if test "$item" = newline
|
||||
set_color $previousColor -b normal
|
||||
printf '%s' $fake_tide_right_prompt_suffix\n
|
||||
else
|
||||
set -l output (_fake_tide_item_$item)
|
||||
test -n "$output" || continue
|
||||
|
||||
set -l colorName fake_tide_"$item"_bg_color
|
||||
set -l color $$colorName
|
||||
|
||||
if test "$lastItem" = newline
|
||||
set_color $color -b normal
|
||||
printf '%s' $fake_tide_right_prompt_prefix
|
||||
else if test "$color" = "$previousColor"
|
||||
set_color $fake_ printf '%s' $fake_tide_right_prompt_separator_same_color
|
||||
else
|
||||
set_color $color -b $previousColor
|
||||
printf '%s' $fake_tide_right_prompt_separator_diff_color
|
||||
end
|
||||
|
||||
set_color -b $color
|
||||
|
||||
if test "$fake_tide_prompt_pad_items" = true -a "$item" != character
|
||||
printf '%s' " $output "
|
||||
else
|
||||
printf '%s' "$output"
|
||||
end
|
||||
|
||||
set previousColor $color
|
||||
end
|
||||
set lastItem $item
|
||||
end
|
||||
|
||||
if test "$lastItem" != newline
|
||||
set_color $previousColor -b normal
|
||||
printf '%s' $fake_tide_right_prompt_suffix
|
||||
end
|
||||
end
|
@ -1,36 +0,0 @@
|
||||
function fake_prompt
|
||||
# Variables are exported as strings, convert _fake_tide_last_pipestatus back into a list
|
||||
set -g _fake_tide_last_pipestatus (string split ' ' $_fake_tide_last_pipestatus)
|
||||
|
||||
set -l leftPrompt (_fake_tide_left_prompt)
|
||||
set -l leftPromptHeight (count $leftPrompt)
|
||||
set -l rightPrompt (_fake_tide_right_prompt)
|
||||
|
||||
if test $leftPromptHeight -gt 1
|
||||
if test "$fake_tide_left_prompt_frame_enabled" = true
|
||||
set -l frameColor (set_color $fake_tide_left_prompt_frame_color -b normal || echo)
|
||||
set leftPrompt[1] $frameColor╭─"$leftPrompt[1]"
|
||||
set leftPrompt[2] $frameColor╰─"$leftPrompt[2]"
|
||||
end
|
||||
if test "$fake_tide_right_prompt_frame_enabled" = true
|
||||
set -l frameColor (set_color $fake_tide_right_prompt_frame_color -b normal || echo)
|
||||
set rightPrompt[1] "$rightPrompt[1]"$frameColor─╮
|
||||
set rightPrompt[2] "$rightPrompt[2]"$frameColor─╯
|
||||
end
|
||||
|
||||
printf '%s' $leftPrompt[1]
|
||||
|
||||
set_color $fake_tide_prompt_connection_color
|
||||
set -l decoloredTextLength (_tide_decolor "$leftPrompt[1]""$rightPrompt[1]" | string length)
|
||||
test -n "$fake_tide_prompt_icon_connection" || set -l fake_tide_prompt_icon_connection ' '
|
||||
string repeat --no-newline --max (math $fake_columns - $decoloredTextLength) $fake_tide_prompt_icon_connection
|
||||
|
||||
printf '%s\n' $rightPrompt[1]
|
||||
end
|
||||
|
||||
printf '%s' $leftPrompt[-1]
|
||||
set -l decoloredTextLength (_tide_decolor "$leftPrompt[-1]""$rightPrompt[$leftPromptHeight]" | string length)
|
||||
string repeat --no-newline --max (math $fake_columns - $decoloredTextLength) ' '
|
||||
printf '%s' $rightPrompt[$leftPromptHeight]
|
||||
set_color normal
|
||||
end
|
@ -1,4 +1,3 @@
|
||||
function _fake_tide_item_cmd_duration
|
||||
set_color $fake_tide_cmd_duration_color
|
||||
printf '%s' $fake_tide_cmd_duration_icon' ' 5s
|
||||
_fake_tide_print_item cmd_duration $fake_tide_cmd_duration_icon' ' 5s
|
||||
end
|
||||
|
@ -1,4 +1,3 @@
|
||||
function _fake_tide_item_git
|
||||
set_color $fake_tide_git_color_branch
|
||||
printf '%s' $fake_tide_git_icon' ' main
|
||||
_fake_tide_print_item git (set_color $fake_tide_git_color_branch) $fake_tide_git_icon' ' main
|
||||
end
|
||||
|
@ -1,4 +1,3 @@
|
||||
function _fake_tide_item_os
|
||||
set_color $fake_tide_os_color
|
||||
printf '%s' $_tide_os_icon
|
||||
_fake_tide_print_item os $_tide_os_icon
|
||||
end
|
||||
|
@ -1,4 +1,3 @@
|
||||
function _fake_tide_item_character
|
||||
set_color $fake_tide_character_color_success
|
||||
printf '%s ' '❯'
|
||||
fake_tide_character_color=$fake_tide_character_color_success _fake_tide_print_item character '❯ '
|
||||
end
|
||||
|
@ -1,15 +1,7 @@
|
||||
function _fake_tide_item_pwd
|
||||
printf '%s' (set_color $fake_tide_pwd_color_dirs)$fake_tide_pwd_icon_dir' '
|
||||
|
||||
set_color -o $fake_tide_pwd_color_anchors
|
||||
printf '%s' '~'
|
||||
set_color normal -b $fake_tide_pwd_bg_color
|
||||
|
||||
set_color $fake_tide_pwd_color_dirs
|
||||
printf '%s' /
|
||||
set_color normal -b $fake_tide_pwd_bg_color
|
||||
|
||||
set_color -o $fake_tide_pwd_color_anchors
|
||||
printf '%s' src
|
||||
set_color normal -b $fake_tide_pwd_bg_color
|
||||
_fake_tide_print_item pwd \
|
||||
(set_color $fake_tide_pwd_color_dirs)$fake_tide_pwd_icon_dir' ' \
|
||||
(set_color -o $fake_tide_pwd_color_anchors)'~'(set_color normal -b $fake_tide_pwd_bg_color) \
|
||||
(set_color $fake_tide_pwd_color_dirs)'/'(set_color normal -b $fake_tide_pwd_bg_color) \
|
||||
(set_color -o $fake_tide_pwd_color_anchors)'src'(set_color normal -b $fake_tide_pwd_bg_color)
|
||||
end
|
||||
|
@ -1,4 +1,3 @@
|
||||
function _fake_tide_item_time
|
||||
set_color $fake_tide_time_color
|
||||
printf '%s' (date +$fake_tide_time_format)
|
||||
_fake_tide_print_item time $tide_time_icon' ' (date +$fake_tide_time_format)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user