Make status item smarter, remove tide_status_always_display

This commit is contained in:
Ilan Cosman 2021-03-07 21:43:39 -08:00
parent a55612d38f
commit e954a609ac
6 changed files with 25 additions and 40 deletions

View File

@ -1,7 +1,7 @@
function _tide_item_status
if string match --quiet --invert 0 $_tide_last_pipestatus # If there is a failure anywhere in the pipestatus
if test "$_tide_last_pipestatus" = 1 # If simple failure
if test "$tide_status_always_display" = true
if not contains prompt_char $tide_left_prompt_items
set -g tide_status_bg_color $tide_status_failure_bg_color
set_color $tide_status_failure_color
printf '%s' $tide_status_failure_icon' ' 1
@ -19,7 +19,7 @@ function _tide_item_status
fish_status_to_signal $_tide_last_pipestatus | string replace SIG '' | string join '|'
end
else if test "$tide_status_always_display" = true
else if not contains prompt_char $tide_left_prompt_items
set -g tide_status_bg_color $tide_status_success_bg_color
set_color $tide_status_success_color
printf '%s' $tide_status_success_icon

View File

@ -43,8 +43,6 @@ function _tide_finish
if contains prompt_char $fake_tide_left_prompt_items
_find_and_remove vi_mode fake_tide_right_prompt_items
else
set fake_tide_status_always_display true # Without a prompt_char, the user won't know if a command failed/succeeded
# If no prompt_char, insert vi_mode
_find_and_remove vi_mode fake_tide_right_prompt_items
if contains time $fake_tide_right_prompt_items

View File

@ -73,7 +73,6 @@ tide_chruby_icon ''
tide_rust_bg_color 444444
tide_rust_color 00AFAF
tide_rust_icon ''
tide_status_always_display false
tide_status_failure_bg_color 444444
tide_status_failure_color D70000
tide_status_failure_icon '✘'

View File

@ -73,7 +73,6 @@ tide_chruby_icon ''
tide_rust_bg_color normal
tide_rust_color 00AFAF
tide_rust_icon ''
tide_status_always_display false
tide_status_failure_bg_color normal
tide_status_failure_color D70000
tide_status_failure_icon '✘'

View File

@ -73,7 +73,6 @@ tide_chruby_icon ''
tide_rust_bg_color FF8700
tide_rust_color 2E3436
tide_rust_icon ''
tide_status_always_display false
tide_status_failure_bg_color CC0000
tide_status_failure_color FFFF00
tide_status_failure_icon '✘'

View File

@ -5,42 +5,11 @@ function _status
_tide_decolor (_tide_item_status)
end
set -lx tide_status_success_icon
set -lx tide_status_failure_icon
true | false
_status # CHECK: 0|1
false | true
_status # CHECK: 1|0
set -lx tide_status_success_icon '✔'
set -lx tide_status_failure_icon '✘'
set -lx tide_status_always_display false
true
_status # CHECK:
false
_status # CHECK:
true | false
_status # CHECK: ✘ 0|1
true | true
_status # CHECK:
false | true
_status # CHECK: ✔ 1|0
false | false
_status # CHECK: ✘ 1|1
set -lx tide_status_always_display true
# Without prompt_char
set -lx tide_left_prompt_items
true
_status # CHECK: ✔
@ -59,3 +28,24 @@ _status # CHECK: ✔ 1|0
false | false
_status # CHECK: ✘ 1|1
# With prompt_char
set -lx tide_left_prompt_items prompt_char
true
_status # CHECK:
false
_status # CHECK:
true | false
_status # CHECK: ✘ 0|1
true | true
_status # CHECK:
false | true
_status # CHECK: ✔ 1|0
false | false
_status # CHECK: ✘ 1|1