fish-shell/doc_src
Fabian Homborg 64b34c8cda Allow complete to have multiple conditions
This makes it so `complete -c foo -n test1 -n test2` registers *both*
conditions, and when it comes time to check the candidate, tries both,
in that order. If any fails it stops, if all succeed the completion is offered.

The reason for this is that it helps with caching - we have a
condition cache, but conditions like

```fish
test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] length

test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub
```

defeats it pretty easily, because the cache only looks at the entire
script as a string - it can't tell that the first `test` is the same
in both.

So this means we separate it into

```fish
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] length" -s V -l visible -d "Use the visible width, excluding escape sequences"
+complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] length" -s V -l visible -d "Use the visible width, excluding escape sequences"
```

which allows the `test` to be cached.

In tests, this improves performance for the string completions by 30%
by reducing all the redundant `test` calls.

The `git` completions can also greatly benefit from this.
2022-05-30 20:47:14 +02:00
..
cmds Allow complete to have multiple conditions 2022-05-30 20:47:14 +02:00
python_docs_theme Remove searchtools.js 2022-05-19 17:38:41 +02:00
commands.rst Add documentation for prompt_hostname 2021-12-04 10:37:49 +01:00
completions.rst Search $__fish_user_data_dir for vendor additions 2022-05-12 20:29:05 +02:00
conf.py docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
design.rst Docs: Posix -> POSIX 2022-02-14 16:18:16 -08:00
faq.rst Remove stray xsel from docs 2022-04-19 18:52:06 +02:00
fish_for_bash_users.rst Remove references to match/expand in the docs 2022-05-29 17:48:11 +02:00
fish_indent_lexer.py docs: restore default highlighting keywords and options in HTML 2022-01-16 14:07:19 +01:00
fish_synopsis.py docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
index.rst docs/index: reword default shell section 2022-03-29 13:33:06 +08:00
interactive.rst Document some missing color variables 2022-04-24 21:31:51 +02:00
language.rst Remove references to match/expand in the docs 2022-05-29 17:48:11 +02:00
license.rst Bump copyright year 2022-01-09 23:47:58 +08:00
relnotes.rst docs: call the CHANGELOG "release notes" 2021-02-25 22:46:24 +08:00
tutorial.rst docs: Remove prompt from multiline commands 2022-03-11 19:05:26 +01:00