Skip to content

Commit

Permalink
Add transient choice to configure
Browse files Browse the repository at this point in the history
  • Loading branch information
IlanCosman committed Sep 20, 2023
1 parent 7c1497d commit ccb149f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 6 deletions.
17 changes: 14 additions & 3 deletions functions/_tide_sub_configure.fish
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,21 @@ 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
if set -q _configure_transient
if contains newline $fake_tide_left_prompt_items
string unescape $prompt[3..]
else
_fake_tide_item_character
echo
end
else
if not set -q _tide_configure_first_prompt_after_option
test "$fake_tide_prompt_add_newline_before" = true && echo
end
string unescape $prompt[2..]
end
string unescape $prompt[2..]

set -e _tide_configure_first_prompt_after_option
set_color normal
end

Expand Down
2 changes: 1 addition & 1 deletion functions/tide/configure/choices/all/icons.fish
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function icons
case 'Few icons'
_disable_icons
end
_next_choice all/finish
_next_choice all/transient
end

function _enable_icons
Expand Down
22 changes: 22 additions & 0 deletions functions/tide/configure/choices/all/transient.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function transient
_tide_title 'Enable transient prompt?'

_tide_option 1 No
_tide_display_prompt
_tide_display_prompt
_tide_display_prompt

_tide_option 2 Yes
_configure_transient= _tide_display_prompt
_configure_transient= _tide_display_prompt
_tide_display_prompt

_tide_menu (status function)
switch $_tide_selected_option
case No
set fake_tide_prompt_transient_enabled false
case Yes
set fake_tide_prompt_transient_enabled true
end
_next_choice all/finish
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
function _fake_tide_item_character
set_color $fake_tide_character_color
contains newline $fake_tide_left_prompt_items || echo -ns ' '
echo -ns $fake_tide_character_icon
if contains newline $fake_tide_left_prompt_items || set -q _configure_transient
echo -ns $fake_tide_character_icon
else
echo -ns ' '$fake_tide_character_icon
end
end

0 comments on commit ccb149f

Please sign in to comment.