This was already supposed to handle `--foo=bar<TAB>` cases, except it
printed the `--foo=` again, causing fish to take that as part of the
token.
See #9538 for a similar thing with __fish_complete_directories.
Fixes#10011
This is the most common and sensible env var, we check it outside,
so we can skip loading the function at all if we already know it's not
gonna do anything.
This is done on every startup of every single fish, and it saves ~0.2ms.
This can be triggered by having a custom git command in e.g.
`/mnt/c/Program Files (x86)/foo/`.
Fixes#9738
(cherry picked from commit db5c9badad6162e79dbf68ec83275de6df061e1d)
When no development dependencies are installed, the completion would crash with:
KeyError: 'require-dev'
(cherry picked from commit 9e223577aa95ea56b0907035bb50bbba5ae47d24)
While it is true that `git switch <remote-branch>` errors to disallow a detached
head without the `-d` option, it is valid to use any starting point (commit or
reference) in conjunction with the `-c` option. Additionally, the starting point
can occur before any option.
This enables the following completions:
* `git switch -c <local-name> <any-branch>`
* `git switch <any-branch> -c <local-name>`
* `git switch -d <any-starting-point>`
* `git switch <any-branch> -d`
The trade-off is this does allow for `git switch <remote-branch>` to be
completed with an error.
Note that this logically reverts 7e3d3cc30f61d466f450a61ebee7c7fcd264967f.
(cherry picked from commit fdd4bcf718693b6224404ae2215da7c44f0784ac)
I sometimes find myself doing something like this:
- Look for a commandline that includes "echo" (as an example)
- Type echo, press up a few times
- I can't immediately find what I'm looking for
- Press ctrl-r to open up the history pager
- It uses the current commandline as the search string,
so now I'm looking for "echo foobar"
This makes it so if the search string already is in use, that's what
the history-pager picks as the initial search string.
Vi visual mode selection highlighting behaves unexpectedly when the selection
foreground and background in the highlight spec don't match. The following
unexpected behaviors are:
* The foreground color is not being applied when defined by the
`fish_color_selection` variable.
* `set_color` options (e.g., `--bold`) would not be applied under the cursor
when selection begins in the middle of the command line or when the cursor
moves forward after visually selecting text backward.
With this change, visual selection respects the foreground color and any
`set_color` options are applied consistently regardless of where visual
selection begins and the position of the cursor during selection.
(cherry picked from commit 4ed53d4e3f8b4553a94dbd3b64c3e0bdd793cb0b)
All *.theme files set variables documented in the "Syntax highlighting
variables" section, and fish_color_history_current was missing.
(cherry picked from commit a6e16a11c22b6228bc292bfdd757e7e69710e879)
This is an additional tool, and this function is executed on source
time so we'd spew errors.
(also remove an ineffective line - it's probably *nicer* with the
read, but that's not what's currently effectively doing anything)
(cherry picked from commit 85504ca694ae099f023ae0febb363238d9c64e8d)
This reverts commit 0b55f08de23f818cc4d839dace6926d30cf941dc.
This was found to have caused regressions in completions in #9699
(cherry picked from commit c67d77fc1887eb7b5cd070630a59abe12d24a22e)
This prevents leaking the escape sequence by printing nonsense, and it
also allows disabling cursor setting by just setting the variable to
e.g. empty.
And if we ever added any shapes, it would allow them to be used on new
fish and ignored on old
Fixes#9698
(cherry picked from commit e45bddcbb1b9c42cf0694880fbb347aaf9775573)
Otherwise this would complete
`git --exec-path=foo`, by running `complete -C"'' --exec-path=foo"`,
which would print "--exec-path=foo", and so it would end as
`git --exec-path=--exec-path=foo` because the "replaces token" bit was
lost.
I'm not sure how to solve it cleanly - maybe an additional option to
`complete`?
Anyway, for now this
Fixes#9538.
(cherry picked from commit c39780fefbfc26554cd2ff0c8400884ced4c07e7)
Another from the "why are we asserting instead of doing something
sensible" department.
The alternative is to make exit() and return() compute their own exit
code, but tbh I don't want any *other* builtin to hit this either?
Fixes#9659
(cherry picked from commit a16abf22d9292f232ec7d57b3cf42e2e93ffbb0a)
It's not of much use (read will only read a single line anyway) and
breaks things
Fixes#8285
(cherry picked from commit af49b4d0f8edc49da0ec0871e1fb665ef2332d48)
* feat: add support for fossil-scm in prompt
* fix: change directory testing and string matching
(cherry picked from commit cf67709931ce5f61f05a31b00dbf1de9e705b52f)
This was the remaining immediately actionable part of #7375.
It's not definitely the last word, but a change here would require a
bigger plan.
Fixes#7375
Apparently this is actually a point of confusion.
Unfortunately we can't use `which` here because 1. it might not be
installed, 2. it might be trash.
So we give instructions from inside fish, and explain that they
should *typically* work.
See #10002
Without this, a recipe containing a trailing backslash followed by a line not
beginning with tab (like any non-continued recipe lines would) would result in
the continuation showing up in completions.
Whenever a line ends in a backslash, consider the next line invalid as a target.
Regex explanation:
^([^#]*[^#\\])? -- optional prefix not containing comment character and not
ending in backslash
(\\\\)*\\$ -- 2n+1 backslashes at end of line (handles escaped backslashes)