Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/character icon failure #490

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
180 changes: 180 additions & 0 deletions tests/_tide_item_character.test.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# 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 ✘

# Check icons while fish_key_bindings is fish_default_key_bindings
set -lx fish_key_bindings fish_default_key_bindings

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: ✘

# Check icons while fish_key_bindings isn't fish_default_key_bindings
set -lx fish_key_bindings something_else
# Check icons while fish_bind_mode is default
set -lx fish_bind_mode default

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: ❮

# Check icons while fish_bind_mode is insert
set -lx fish_bind_mode insert

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: ✘

# Check icons while fish_bind_mode is replace
set -lx fish_bind_mode replace

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: ▶

# Check icons while fish_bind_mode is replace_one
set -lx fish_bind_mode replace_one

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: ▶

# Check icons while fish_bind_mode is visual
set -lx fish_bind_mode visual

true
_character # CHECK: V

false
_character # CHECK: V

true | false
_character # CHECK: V

true | true
_character # CHECK: V

false | true
_character # CHECK: V

false | false
_character # CHECK: V

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

not false | true
_character # CHECK: V