-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bugSomething that's not working as intendedSomething that's not working as intended
Milestone
Description
While testing out the new fish_add_path --move, I noticed incorrect paths being removed/moved stemming from
| set -e newvar[$indexes] |
A simple repro is:
> set arr 1 2 3
> set -e arr[1] arr[2] # expanded form of arr[$indexes] above
> echo $arr
2 # expected 3As you can see, set -e arr[1] works fine but presumably when set -e arr[2] occurs, arr = 2 3. The elements should be erased in index-descending order as set -e arr[1 2] correctly handles. Thus, a workaround for my initial issue is
diff --git a/share/functions/fish_add_path.fish b/share/functions/fish_add_path.fish
index cac0d9d4f..11e1017a0 100644
--- a/share/functions/fish_add_path.fish
+++ b/share/functions/fish_add_path.fish
@@ -63,7 +63,7 @@ function fish_add_path --description "Add paths to the PATH"
set -l newvar $$var
if set -q _flag_move; and set -q indexes[1]
# We remove in one step, so the indexes don't move.
- set -e newvar[$indexes]
+ set -e newvar[(echo $indexes)]
end
set $mode newvar $newpathsSystem info
> fish --version
fish, version 3.2.0
> uname -a
Darwin Branchs-MacBook-Pro.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
> echo $TERM
xterm-256color
> sh -c 'env HOME=$(mktemp -d) fish'
# reproducesBtw, amazing work on fish! It is such a joy to use!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething that's not working as intendedSomething that's not working as intended