Skip to content

Commit

Permalink
adding a new icon for character when there's a failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco-Veio committed Feb 4, 2024
1 parent fbca958 commit 04166dd
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
7 changes: 5 additions & 2 deletions functions/_tide_item_character.fish
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ function _tide_item_character

set -q add_prefix || echo -ns ' '

test "$fish_key_bindings" = fish_default_key_bindings && echo -ns $tide_character_icon ||
if test $fish_key_bindings = fish_default_key_bindings
test $_tide_status = 0 && echo -ns $tide_character_icon || echo -ns $tide_character_icon_failure
else
switch $fish_bind_mode
case insert
echo -ns $tide_character_icon
test $_tide_status = 0 && echo -ns $tide_character_icon || echo -ns $tide_character_icon_failure
case default
echo -ns $tide_character_vi_icon_default
case replace replace_one
echo -ns $tide_character_vi_icon_replace
case visual
echo -ns $tide_character_vi_icon_visual
end
end
end
1 change: 1 addition & 0 deletions functions/tide/configure/icons.fish
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
tide_aws_icon  # Actual aws glyph is harder to see
tide_character_icon ❯
tide_character_icon_failure ❯
tide_character_vi_icon_default ❮
tide_character_vi_icon_replace ▶
tide_character_vi_icon_visual V
Expand Down
35 changes: 35 additions & 0 deletions tests/_tide_item_character.test.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# RUN: %fish %s
_tide_parent_dirs

function _character
set -lx _tide_status $status
set -lx _tide_pipestatus $pipestatus
_tide_decolor (_tide_item_character)
end

set -lx tide_character_icon_failure ✘

true
_character # CHECK: ❯

false
_character # CHECK: ✘

true | false
_character # CHECK: ✘

true | true
_character # CHECK: ❯

false | true
_character # CHECK: ❯

false | false
_character # CHECK: ✘

# Check that not command works
not true | false
_character # CHECK: ❯

not false | true
_character # CHECK: ✘

0 comments on commit 04166dd

Please sign in to comment.