mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-18 17:11:15 -03:00
Switch to bare vars in our math invocations
Using bare vars is more efficient because it makes the builtin `math` expression cache more useful. That's because if you prefix each var with a dollar-sign then the fish parser expands it before `math` is run. Something like `math x + 1` can be cached since the expression is the same each time it is run. But if you do `math $x + 1` and x==1 then you're effectively executing `math 1 + 1`. And if x==2 the next time then you're running `math 2 + 1`. Which makes the expression cache much less effective.
This commit is contained in:
@@ -15,7 +15,7 @@ function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowin
|
||||
for i in $cmd
|
||||
|
||||
if test $skip_next -gt 0
|
||||
set skip_next (math $skip_next - 1)
|
||||
set skip_next (math skip_next - 1)
|
||||
continue
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowin
|
||||
else
|
||||
|
||||
if contains -- $i $argv
|
||||
set skip_next (math $skip_next + 1)
|
||||
set skip_next (math skip_next + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user