19983 Commits

Author SHA1 Message Date
Peter Ammon
7c32cb1b44
Put back noun form of "licence" in mksquashfs comment 2025-02-02 11:48:37 -08:00
Fabian Boehm
8d6fdfd9de Remove cmake "test" target
This can no longer be overridden, which means we have a broken "test"
target now. Instead, you need to call "make fish_run_tests".

Blergh.

Fixes #11116
2025-02-02 13:41:43 +01:00
ccoVeille
0df6fa7915 Fix typos in completions scripts 2025-02-02 17:15:11 +08:00
Ilya Grigoriev
5dd6759d01
completions/tmux: replace embedded tabs with \t 2025-02-01 17:37:38 -08:00
Ilya Grigoriev
2b6f6b8cbc
completions/tmux: basic window argument completions 2025-02-01 17:37:38 -08:00
Ilya Grigoriev
5d0e2244bb
completions/tmux: add ability to complete buffer names and commands
This adds the ability to complete (and therefore preview) buffer names,
and adds incomplete (aiming to maximize utility/effort, similarly to
b1064ac) bindings to the `tmux` buffer commands.

The main benefit is, IMO, is the tab completion for `tmux paste-buffer
-b` and `tmux show-buffer -b`.
2025-02-01 17:37:38 -08:00
Johannes Altmanninger
66e2b6d8c1 Fix query response wait confusion over builtin read
Every reader gets their own wait handle which is wrong and not actually
needed - it's a singleton.  We should probaly make it global. Let's
do an intermediate solution for now -- not much time this weekend ;).

Fixes #11110
2025-02-01 09:25:53 +01:00
Mahmoud Al-Qudsi
cbedfc8a64 Use Write::write_all(), not write()
There is no guarantee that Write::write() will write the entirety of the
provided buffer in one go, regardless of how short it is, because that depends
on the semantics of the underlying write handle (even if it was a
single byte, though in this case that would be because of an interrupt).

The only case I'm aware of that would guarantee a single Write::write() call
would suffice is when writing into a high-level memory-backed buffer, and we
can't make that guarantee (now or in perpetuity).
2025-01-31 11:25:56 -06:00
Fabian Boehm
9a46b66d04 Increase default read limit to 1GiB
The current limit can be reached in actual use and still be a usable shell.

E.g. in #11095 someone had `git status` print over 100MiB of file
information.
2025-01-31 16:44:25 +01:00
Fabian Boehm
5eee4fc2c7 completions/git: Don't set the read limit
This isn't propagated correctly:

If $fish_read_limit is set globally, it won't apply to the completion
command substitution, *unless* you set fish_read_limit inside of that
function.

I'm not entirely sure how that happens, but let's work around it for
now by removing that limit.

I'm going to increase the default limit in a future commit, because
it's not something supposed to be reachable in ordinary code.

See #11106
2025-01-31 16:37:26 +01:00
Fabian Boehm
6d8f1aeb27 Reset read_limit back to default
Regression introduced in 6638c78b30310c9c0b235e989827d9639a7897c4

Reintroduces #9129

It's unclear why the tests didn't fail
2025-01-31 16:31:39 +01:00
kerty
bfb32cdbd9 Improve calculation of offset for width 2025-01-31 13:37:27 +01:00
kerty
c54131c8c5 Make at least one character of the autosuggestion always shown
Previously, there were situations where an autosuggestion existed but was not shown at all. This commit guarantees that at least the `ellipsis_char` is shown, regardless of the situation.
2025-01-31 13:37:27 +01:00
kerty
0ecf4b1ce0 Fix inconsistent autosuggestion truncation on soft wrapped lines
This commit ensures that autosuggestions cannot soft wrap. Previous behavior:
- If the first line is not soft wrapped, the autosuggestion will be truncated and not shown on soft-wrapped lines.
- If the first line is soft-wrapped, the autosuggestion will not have any limit.
2025-01-31 13:37:27 +01:00
kerty
be95b176bc Fix incorrect first line checks in rendering
The right prompt was rendered even if scrolled.
The command line wasn't rendering on the first line, starting from 0 to the left prompt length. Steps to reproduce:
fish -C 'bind ctrl-g \'commandline $(printf %0"$(math $COLUMNS)"d0) $(seq $(math $LINES - 1))\''
# use ctrl-g
# observe that only one '0' is rendered
2025-01-31 13:37:27 +01:00
kerty
e2c9969840 Fix deletion of prompt in last 2 columns when first line soft wrapped
When drawing a soft wrapped line, the last 2 characters of the previous line are redrawn. If these 2 characters are occupied by the prompt, they are replaced with ' '.
Steps to reproduce:
fish -C 'function fish_prompt; printf %0"$(math $COLUMNS)"d 0; end'
# type anything
# observe that the last two characters of the prompt have been deleted
2025-01-31 13:37:27 +01:00
kerty
9915a07741 Convert Screen::write_char() to usize 2025-01-31 13:37:27 +01:00
kerty
7acc2b7223 Fix pager occupying empty soft wrapped lines
We need to add a line to the desired screen if the previous line was full or non-existent to prevent the pager from being drawn on empty soft wrapped or new lines.
Steps to reproduce:
fish -C '
    function fish_prompt; printf \>; end
    bind ctrl-g \'commandline  "ls $(printf %0"$(math $COLUMNS - 5)"d 0) "\''
# use ctrl-g and tab
# observe that the pager starts on the line with the cursor
2025-01-31 13:37:27 +01:00
kerty
5ecf5aef8a Fix regression causing variable completions to not have description
Regressed in 17bd7d0 (Switch completion_request_options_t from a list of flags to a struct, 2022-06-07).
2025-01-31 13:37:27 +01:00
kerty
1339da330e Fix crash when clicking on empty lines
This fixes a crash that occurred in Kitty when clicking on lines without characters, such as soft wrapped lines or first line without a prompt.
2025-01-31 13:37:27 +01:00
kerty
6bb19cf1f4 Fix not emitting osc_133_prompt_start without prompt
If the left prompt is defined to be empty, osc_133_prompt_start would not be emitted at all.
2025-01-31 13:37:27 +01:00
kerty
d667ec5061 Remove space for prompt if it occupies full line
If the prompt occupies the full width of the first line, each new line will soft wrap, leaving empty lines between. This change removes the indentation that matches the start of the line to the end of the prompt if the prompt width equals the terminal width.

Steps to reproduce:
fish -C 'function fish_prompt; printf %0"$COLUMNS"d 0; end'
# type "begin" and Enter
# observe that there was a spurious empty line
2025-01-31 13:37:27 +01:00
Fabian Boehm
e63fea1127 reader: only flash entire commandline if token is empty
So `git add dsfiojdsoif<TAB>` flashes the token, `git add <TAB>`
flashes the entire commandline because there is no token to flash
2025-01-30 17:13:09 +01:00
Fabian Boehm
4ae3c487a6 reader: flash entire commandline if there's no completion
This is often the case if the token is empty, e.g `git add <TAB>`
outside of a git repo.
2025-01-30 16:24:35 +01:00
Fabian Boehm
6c4d658c15 pager: fix selected color regression
To check:

```fish
fish_config theme choose None
set -g fish_pager_color_selected_completion blue
```

Now the selected color will only apply to the parentheses

Missed in 43e2d7b48c21d1377c2bd34b3b2ef9c0016a38e4 (Port pager.cpp)
2025-01-30 16:22:07 +01:00
Fabian Boehm
ba193665e2 completions: Add missing options for our builtins 2025-01-29 20:38:41 +01:00
Fabian Boehm
66f1aba0f2 completions/commandline: Add missing options
Some checks failed
Rust checks / clippy (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
make test / macos (push) Has been cancelled
Lock threads / lock (push) Has been cancelled
2025-01-29 20:17:46 +01:00
Fabian Boehm
ef4fad763f Remove fish.desktop harder 2025-01-29 17:21:14 +01:00
Justin Zobel
a42c5b4025 Remove fish.desktop file as it was only needed for AppImages which were decided against. 2025-01-29 17:19:39 +01:00
David Adam
be48d73599 docs/fish: minor style/proofing edits 2025-01-29 20:28:00 +08:00
David Adam
1cf71656ef docs/language: update target release for feature flags from 3.8 to 4.0
see also 24abbb6de7f044
2025-01-29 20:27:14 +08:00
Johannes Altmanninger
acf9ba4195 Fix regression causing missing automatic history saving after adding ephemeral items
Commit f36f757fa6 (Never rewrite history file when adding ephemeral
items, 2024-10-06) has a glaring bug: when adding to history ephemeral
items that has potential paths, we fail to re-enable automatic saving,
which effectively disables automatic saving for the entire session.

Only a call to history::save_all() at exit saves us from losing data.
But until exit, other fish will see our history (unless we run history
save/merge or similar).

Fix the imbalanced enable/disable and restructure the code a bit.
Also, extend the change from f36f757fa6 (never vacuum on ephemeral
items) to private mode.
2025-01-29 10:16:19 +01:00
Ilya Grigoriev
064d867873 language.rst: make description of features more consistent (minor)
The version where a feature became the default is now described inline,
to make it a single source of truth. I could have fixed the other
section where this was described, but this seemed easier.

I also removed a few details that seem no longer relevant.
2025-01-28 21:23:45 -08:00
David Adam
2184aaf9b4 completions/acpi: correct the -c option as cooling
Closes #11068.
2025-01-28 21:47:05 +08:00
Ilya Grigoriev
f241187c4a completions/tmux: some windows and panes boolean flag completions
This documents some non-argument options for the window and panes
commands. The choice of what to document is somewhat arbitrary,
this commit is biased towards options that I find confusing or
misleading without documentation (is `-a` "all" or "after"?)
and the command that seem more useful to me.

I also didn't cover the options that would be covered by
#10855 (though this PR can be used independently). I'm not
sure how much difference this made, it might not matter at
all.
2025-01-28 21:38:34 +08:00
Ilya Grigoriev
77406ddd11 completions/tmux: complete commands inside tmux lscm
Make `tmux lscm <tab>` work.
2025-01-28 21:37:16 +08:00
Ilya Grigoriev
183e20cc3a completions/tmux: complete all flags when tmux lscm is available
These dynamic completions are exhaustive, but not as well-documented or
as ergonomic as the manual completions. So, any manual completions
should override them.
2025-01-28 21:37:16 +08:00
Ilya Grigoriev
27e5ed7456 completions/tmux: complete all subcommands when tmux lscm works
For example, `tmux shell<tab>` now completes to `if-shell` and
`run-shell`, though no additional information is provided.
2025-01-28 21:37:16 +08:00
Johannes Altmanninger
d2b2c5286a Fix regression decoding function keys
Commit 109ef88831 (Add menu and printscreen keys, 2025-01-01)
accidentally broke an assumption by inverting f1..f12.  Fix that.

Fixes #11098
2025-01-27 21:49:29 +01:00
Fabian Boehm
9116c61736 completions/nmcli: Complete at runtime
This used to get all the interfaces and ssids when the completions
were loaded. That's obviously wrong, given that ssids especially can, you know, change
2025-01-27 20:46:38 +01:00
Fabian Boehm
4370fb755d completions/git: Handle untracked files separately
This uses `git ls-files`, which has a simpler format (just the
filenames on separate lines), in order to print the untracked files.

This allows us to skip them in the `git status` call, which reduces
the output a lot and removes two `string match`.

In a repository with over half a million files (my home directory, if
I made it one), this improves time by a third (12s to 8s).

In a smaller repo (fish-shell) it's barely measurable.
2025-01-27 18:24:08 +01:00
kerty
514f4b9e23 Rename some methods of ReaderHistorySearch to improve clarity 2025-01-27 18:19:04 +01:00
Johannes Altmanninger
b73c8abb79 Fix regression causing crash when history token search hits end
This is consistent with what we do for highlighting history search,
see d7354880e3 (Fix regression causing crash in token history search,
2025-01-27).  In future, we should try to find a better fix (and a
better test).

Fixes the other problem described in #11096
2025-01-27 18:13:07 +01:00
Fabian Boehm
5c81e18b2e completions/git: Handle gigantic repos better
Determine if untracked files are off via `__fish_git`, so we get the
repo used on the commandline etc,

and if it isn't, at least don't error out. Yes, this *can* print a
hundred megabytes of filenames.
2025-01-27 17:52:32 +01:00
Fabian Boehm
bba15c6d14 completions/csvlens: Fix missing option 2025-01-27 17:51:35 +01:00
Johannes Altmanninger
d7354880e3 Fix regression causing crash in token history search
I'm not yet sure how to reproduce 4dfcd4cb4e (reader: Check bounds
for color, 2022-08-26).  Commit 55fd43d86c (Port reader, 2023-12-22)
accidentally changed historical behavior, fix that.

Fixes #11096
2025-01-27 06:32:15 +01:00
Johannes Altmanninger
fff421ad9c Work around mc and dvtm not responding to Primary DA
The two terminals Midnight Commander and dvtm are special in that
they filter requests (or perhaps responses) like

	printf "\x1b[0c"

and don't implement the response themselves -- so we never get
one. Let's work around that until we can fix it.

Disable the kitty protocol in mc for now (to keep the code simple),
though we could certainly re-enable it.

Fixes 64859fc242 (Blocking wait for responses to startup queries, 2025-01-25).
2025-01-27 06:32:15 +01:00
ccoVeille
90e916e164 Fix typo in tests 2025-01-26 20:30:48 -08:00
ccoVeille
0047abbe7a Fix typo in code 2025-01-26 20:30:48 -08:00
ccoVeille
b6a1bedab9 Fix typos in comments 2025-01-26 20:30:48 -08:00