Remove _tide_decolor file

This commit is contained in:
Ilan Cosman 2021-05-19 10:14:21 -07:00
parent 5659392f93
commit 4b3ce437eb
4 changed files with 8 additions and 12 deletions

View File

@ -26,9 +26,11 @@ jobs:
with:
plugins: ilancosman/clownfish $GITHUB_WORKSPACE
- run: fish $GITHUB_WORKSPACE/tests/test_setup.fish
- uses: fish-actions/littlecheck@v1
with:
files: $GITHUB_WORKSPACE/tests/**
files: $GITHUB_WORKSPACE/tests/**.test.fish
syntax-check:
runs-on: ubuntu-latest

View File

@ -4,7 +4,7 @@ function _tide_prompt
test "$tide_prompt_add_newline_before" = true && echo
left_prompt=(_tide_left_prompt) right_prompt=(_tide_right_prompt) if set -q left_prompt[2] # If the prompt is two lines
left_prompt=(_tide_left_prompt) right_prompt=(_tide_right_prompt) if set -q left_prompt[2] # If prompt is two lines
set -l prompt_and_frame_color (set_color $tide_prompt_frame_and_connection_color -b normal || echo)
if test "$tide_left_prompt_frame_enabled" = true
@ -18,7 +18,8 @@ function _tide_prompt
printf '%s' $left_prompt[1] $prompt_and_frame_color
set -l length_to_move (math $COLUMNS - (_tide_decolor "$left_prompt[1]""$right_prompt[1]" | string length))
set -l length_to_move (math $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 $tide_prompt_connection_icon
printf '%s' $right_prompt[1] \n $left_prompt[-1]' '

View File

@ -1,9 +0,0 @@
# RUN: %fish %s
function _decolor -a color
_tide_decolor (set_color $color || echo)'Hello Foo'
end
_decolor red # CHECK: Hello Foo
_decolor normal # CHECK: Hello Foo
_decolor D7AF00 # CHECK: Hello Foo

View File

@ -1,3 +1,5 @@
function _tide_decolor
string replace --all --regex '\e(\[[\d;]*|\(B\e\[)m(\co)?' '' "$argv"
end
funcsave _tide_decolor