Commit Graph

1134 Commits

Author SHA1 Message Date
Johannes Altmanninger
30942e16dc Fix prefix/suffix icase comparisons
As reported on Gitter, running "echo İ" makes history autosuggestion
for "echo i" crash.  This is because history search correctly
returns the former, but string_prefixes_string_case_insensitive("i",
"İ") incorrectly returns false.  This is because the prefix check
is implemented by trimming the rhs to the length of the prefix and
checking if the result is equal to the prefix.  This is wrong because
the prefix computation should operate on the canonical lowercase
version, because that's what history search uses.
2025-12-27 12:19:24 +01:00
Johannes Altmanninger
9460559345 fish_config theme save: don't add --theme=$theme marker nor react to colortheme
The theme marker is set by "fish_config theme choose" to allow
us to react to terminal color theme changes, and to tell future
"fish_config theme choose" invocations which variables it should erase
-- it should not erase color variables not set in the theme file,
like Git prompt colors.

I'm not sure if either really makes sense for "fish_config theme save".
Reacting to terminal color theme changes is weird for universals.

I'm not sure if "fish_config theme save" should erase universal
variables that are not defined in the theme.  Historically, it did
so for a hardcoded list of colors, which is hacky. For now let's
err on the side of leaving around color variables.

The "save" subcommand is deprecated; it's possible that this changes
in future (and we add support for "--theme" to it) but I'm not sure
if we have enough need for that.
2025-12-26 18:10:47 +01:00
Johannes Altmanninger
74af4f10de uvar migration: tell users to restart running sessions
Users who run the default theme are silently migrated to global
variables. Universal color variables are deleted, leaving existing
sessions uncolored. Tell the user to restart them, and make some
other improvements; now it looks like:

	fish: upgraded to version 4.3:
	* Color variables are no longer set in universal scope.
	  To restore syntax highlighting in other fish sessions, please restart them.
	* The fish_key_bindings variable is no longer set in universal scope by default.
	  Migrated it to a global variable set in  ~/.config/fish/conf.d/fish_frozen_key_bindings.fish

Same for users who do not use the default theme (who already got a
message before this change). For them, the first bullet point looks
like this:

	[...]
	* Color variables are no longer set in universal scope by default.
	  Migrated them to global variables set in ~/.config/fish/conf.d/fish_frozen_theme.fish
	  To restore syntax highlighting in other fish sessions, please restart them.
	[...]

Closes #12161
2025-12-26 18:10:47 +01:00
Denys Zhak
daa554123f fish_indent: Keep braces on same line after conjunctions, time, not
Closes #12144
2025-12-25 15:22:53 +01:00
Johannes Altmanninger
fed0269762 Tweak language in "status language" output
Ref: https://github.com/fish-shell/fish-shell/pull/12106#discussion_r2636320834
2025-12-25 15:22:52 +01:00
Johannes Altmanninger
f1c8e6995d On process exit, read output into buffer to fix ordering
This command

	echo $(/bin/echo -n 1; echo -n 2)

sometimes outputs "21" because we implement this as

	let bufferfill = IoBufferfill::create_opts(...);
	...
	let eval_res = parser.eval_with(...);
	let buffer = IoBufferfill::finish(bufferfill);

i.e. /bin/echo and builtin echo both output to the same buffer; the
builtin does inside parser.eval_with(), and the external process may
or may not output before that, depending on when the FD monitor thread
gets scheduled (to run item_callback).

(Unrelated to that we make sure to consume all available input in
"IoBufferfill::finish(bufferfill)" but that doesn't help with
ordering.)

Fix this by reading all available data from stdout after the child
process has exited.

This means we need to pass the BufferFill down to
process_mark_finished_children().

We don't need to do this for builtins like "fg" or "wait",
because commands that buffer output do not get job control, see
2ca66cff53 (Disable job control inside command substitutions,
2021-07-26).
We also don't need to do it when reaping from reader because there
should be no buffering(?).

fish still deviates from other shells in that it doesn't wait for
it's child's stdout to be closed, meaning that this will behave
non-deterministically.

	fish -c '
	    echo -n $(
	        sh -c " ( for i in \$(seq 10000); do printf .; done ) & "
	    )
	' | wc -c

We should fix that later.

Closes #12018
2025-12-25 14:35:54 +01:00
Nahor
7b8f97c1ff Run fish_indent on select test scripts
Run fish_indent on test scripts that will be modified in a later
commit

Not running it on all the files because a quarter of them need fixing,
some of which are badly formatted on purpose
2025-12-21 12:21:25 +01:00
Daniel Rainer
9b75b6ee88 l10n: move po/ to localization/po/
This is done in preparation for Fluent's FTL files, which will be placed
in `localization/fluent/`. Having a shared parent reduces top-level
clutter in the repo and makes it easier to find the localization files
for translators, including realizing that both PO and FTL files exist.

We keep PO and FTL files in separate directories because we need to
rebuild on any changes in the PO directory (technically only when there
are changes to `*.po` files, but due to technical limitations we can't
reliably trigger rebuilds only if those changes but not other files in
the same directory.) Changes to FTL files do not require rebuilds for
dev builds, since for these `rust-embed` does not actually embed them
into the binary but rather loads them from the file system at runtime.

Closes #12193
2025-12-21 12:11:49 +01:00
Fabian Boehm
fb161e9f4d Fix error squiggles when they run into a newline
Our error marking code:

```
function foobar
^~~~~~~^
```

runs fish_wcswidth to figure out how wide the squiggly line should be.

That function returns -1 when it runs into a codepoint that wcwidth
returns -1 for, so the marking would stop at a single `^`.

In some cases, this happens because the error range includes a
newline.

Since we already find the end of the line, and can only mark one line,
we clamp the squiggles at the end of that line.

This improves some markings.

See discussion in #12171
2025-12-18 17:56:04 +01:00
Johannes Altmanninger
2611646232 commandline --cursor: respect transient command line
We have logic to prevent "commandline --cursor 123" inside "complete
-C" from setting the transient commandline's cursor.

But reading this cursor ("commandline --cursor")
is fine and expected to work by completion scripts.

I don't expect there is a use case for setting the cursor while
computing completions, so let's make that an error for now.
Could revisit that.

Closes #11993
2025-12-18 15:13:50 +01:00
Johannes Altmanninger
08600d012f tests/complete: don't remove $PWD
This test removes $PWD which would cause an error if it were to start
a new process.  Normaly we would "cd -" before the removal but later
assertions expect an empty $PWD, so stay there, but don't remove it
to prevent possible surprise.
2025-12-18 15:04:06 +01:00
Johannes Altmanninger
50bcc3cf4f Isolate hack for skipping internal separator
stage_wildcards has no need for INTERNAL_SEPARATOR. Remove it already
at this stage, to avoid the need to have the workaround in the generic
decoding routine.

Unfortunately we still can't add assert!(!fish_reserved_codepoint(c));
to wcs2bytes_callback, since builtin printf still passes arbitrary
characters. We should fix that later.

Test that printf now behaves correctly for INTERNAL_SEPARATOR.
Also add a regression test for 0c9b73e317.
2025-12-18 15:04:06 +01:00
Daniel Rainer
aa8f5fc77e l10n: implement status language builtin
Based on the discussion in
https://github.com/fish-shell/fish-shell/pull/11967

Introduce a `status language` builtin, which has subcommands for
controlling and inspecting fish's message localization status.

The motivation for this is that using only the established environment
variables `LANGUAGE`, `LC_ALL`, `LC_MESSAGES`, and `LANG` can cause
problems when fish interprets them differently from GNU gettext.
In addition, these are not well-suited for users who want to override
their normal localization settings only for fish, since fish would
propagate the values of these variables to its child processes.

Configuration via these variables still works as before, but now there
is the `status language set` command, which allows overriding the
localization configuration.
If `status language set` is used, the language precedence list will be
taken from its remaining arguments.
Warnings will be shown for invalid arguments.
Once this command was used, the localization related environment
variables are ignored.
To go back to taking the configuration from the environment variables
after `status language set` was executed, users can run `status language
unset`.

Running `status language` without arguments shows information about the
current message localization status, allowing users to better understand
how their settings are interpreted by fish.

The `status language list-available` command shows which languages are
available to choose from, which is used for completions.

This commit eliminates dependencies from the `gettext_impl` module to
code in fish's main crate, allowing for extraction of this module into
its own crate in a future commit.

Closes #12106
2025-12-18 15:04:06 +01:00
David Adam
f0b4921ccf Fix export test on openSUSE
openSUSE defines a MANPATHSET variable, so make the match a bit tighter
2025-12-17 10:27:24 +08:00
Johannes Altmanninger
c3a9edceac Truncate autosuggestion lines only at screen edge
From each logical line in the autosuggestion, we show all or nothing.
This means that we may truncate too early -- specifically 1  + the
number of soft-wrappings in this line. Fix that.

See also #12153
2025-12-16 13:16:20 +01:00
Asuka Minato
f417cbc981 Show soft-wrapped portions in autosuggestions
Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>

Closes #12153
2025-12-16 13:16:20 +01:00
Johannes Altmanninger
190d367bc4 Use globals for color variables, react to light/dark mode
Implicitly-universal variables have some downsides:
- It's surprising that "set fish_color_normal ..."
  and "set fish_key_bindings fish_vi_key_bindings" propagate to other
  shells and persist, especially since all other variables (and other
  shells) would use the global scope.
- they don't play well with tracking configuration in Git.
- we don't know how to roll out updates to the default theme (which is
  problematic since can look bad depending on terminal background
  color scheme).

It's sort of possible to use only globals and unset universal variables
(because fish only sets them at first startup), but that requires
knowledge of fish internals; I don't think many people do that.

So:
- Set all color variables that are not already set as globals.
  - To enable this do the following, once, after upgrading:
    copy any existing universal color variables to globals, and:
    - if existing universal color variables exactly match
      the previous default theme, and pretend they didn't exist.
    - else migrate the universals to ~/.config/fish/conf.d/fish_frozen_theme.fish,
      which is a less surprising way of persisting this.
    - either way, delete all universals to do the right thing for most users.
- Make sure that webconfig's "Set Theme" continues to:
  - instantly update all running shells
    - This is achieved by a new universal variable (but only for
      notifying shells, so this doesn't actually need to be persisted).
      In future, we could use any other IPC mechanism such as "kill -SIGUSR1"
      or if we go for a new feature, "varsave" or "set --broadcast", see
      https://github.com/fish-shell/fish-shell/issues/7317#issuecomment-701165897
      https://github.com/fish-shell/fish-shell/pull/8455#discussion_r757837137.
  - persist the theme updates, completely overriding any previous theme.
    Use the same "fish_frozen_theme.fish" snippet as for migration (see above).
    It's not meant to be edited directly. If people want flexibility
    the should delete it.
    It could be a universal variable instead of a conf snippet file;
    but I figured that the separate file looks nicer
    (we can have better comments etc.)
- Ask the terminal whether it's using dark or light mode, and use an
  optimized default. Add dark/light variants to themes,
  and the "unknown" variant for the default theme.
  Other themes don't need the "unknown" variant;
  webconfig already has a background color in context,
  and CLI can require the user to specify variant explicitly if
  terminal doesn't advertise colors.
- Every variable that is set as part of fish's default behavior
  gets a "--label=default" tacked onto it.

  This is to allow our fish_terminal_color_theme event handler to
  know which variables it is allowed to update. It's also necessary
  until we revert 7e3fac561d (Query terminal only just before reading
  from it, 2025-09-25) because since commit, we need to wait until
  the first reader_push() to get query results.  By this time, the
  user's config.fish may already have set variables.

  If the user sets variables via either webconfig, "fish_config theme
  {choose,save}", or directly via "set fish_color_...", they'd almost
  always remove this label.
- For consistency, make default fish_key_bindings global
  (note that, for better or worse, fish_add_path still remains as
  one place that implicitly sets universal variables, but it's not
  something we inject by default)
- Have "fish_config theme choose" and webconfig equivalents reset
  all color variables. This makes much more sense than keeping a
  hardcoded subset of "known colors"; and now that we don't really
  expect to be deleting universals this way, it's actually possible
  to make this change without much fear.

Should have split this into two commits (the changelog entries are
intertwined though).

Closes #11580
Closes #11435
Closes #7317
Ref: https://github.com/fish-shell/fish-shell/issues/12096#issuecomment-3632065704
2025-12-14 17:03:03 +01:00
Johannes Altmanninger
707bfe3ce6 fish_config theme show: list default scheme first
Webconfig does the same ("Add the current scheme first, then the
default.").
2025-12-14 16:29:14 +01:00
Johannes Altmanninger
d8f1a2a24f Move sample_prompts/themes to share/
They are used by "fish_config" CLI too, so no need to make them
private to webconfig.  Putting them at top-level seems simpler overall.
2025-12-14 16:29:14 +01:00
Johannes Altmanninger
7996637db5 Make fish immediately show color changes again
Historically, fish tried to re-exec the prompt and repaint immediately
when a color variable changed.

Commit f5c6306bde (Do not repaint prompt on universal variable events,
but add event handler for fish_color_cwd, 2006-05-11) restricted this
to only variables used in the prompt like "fish_color_cwd".

Commit 0c9a1a56c2 (Lots of work on web config Change to make fish
immediately show color changes, 2012-03-25) added repainting back
for all colors (except for pager colors).

Commit ff62d172e5 (Stop repainting in C++, 2020-12-11) undid that.

Finally, 69c71052ef (Remove __fish_repaint, 2021-03-04) removed the
--on-variable repaint handlers added by the first commit.

So if color changes via either
1. webconfig
2. an event handler reacting to the terminal switching between light/dark mode
3. a binding etc.

then we fail to redraw. Affects both colors used in prompts and those
not used in prompts.

Fix that by adding back the hack from the second commit.  This is
particularly important for case 2, to be added by a following commit.

In future we can remove this hack by making "--on-variable" take
a wildcard.
2025-12-14 16:23:37 +01:00
Johannes Altmanninger
5cc953b18d Default theme variants specialized for light/dark mode
Start by converting the "default" theme's colors to RGB, using
XTerm colors since they are simple, see
https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit.

Then make the following changes:

for both default-light and default-dark:
- Reinstate fish_color_command/fish_color_keyword as blue since one
  of the reasons in 81ff6db62d (default color scheme: Make commands
  "normal" color, 2024-10-02) doesn't hold anymore.
- bravely replace "fish_pager_color_selected_background -r" with
  something that hopefully matches better.
  Note we can't trivially use the fallback to
  "fish_color_search_match", since for unknown reasons,
  "fish_pager_color_selected_background" is only for background and
  the others are for foreground.

for default-light:
- brgreen (00ff00) looks bad on light background, so replace it with green (00cd00).
  This means that we no longer use two different shades of green in the default theme
  (which helps address the "fruit salad" mentioned 81ff6db62d).
- yellow (cdcd00) looks bad on light background, make it darker (a0a000)
- fish_pager_color_progress's --background=cyan (00cdcd) seems a bit too bright, make it darker
  - same for other uses of cyan (also for consistency)
  - this means fish_color_operator / fish_color_escape can use 00cdcd I guess.
for default-dark:
- use bright green (00ff00) for all greens
- use bright blue (5c5cff) instead of regular blue for command/keyword
- make autosuggestions a bit lighter (9f9f9f instead of 7f7f7f) 
- etc.. I think I made the two themes mostly symmetrical.

Part of #11580
2025-12-14 16:21:16 +01:00
Johannes Altmanninger
f264ee0b10 webconfig theme: rename "fish-default" theme
The "fish-" prefix is not needed here and it would add more noise to
a following commit which adds default-{dark,light} variants that use
24 bit RGB colors.
2025-12-14 15:44:58 +01:00
Johannes Altmanninger
ae22cc93db webconfig themes: shell-friendly filenames
For historical reasons (namely the webconfig origin), our theme
names contain spaces and uppercase letters which can be inconvenient
when using the "fish_config theme choose" shell command.  Use more
conventional file names.

Web config still uses the pretty names, using the ubiquitous "# name:"
property.
2025-12-14 15:44:58 +01:00
Nahor
7fc27e9e54 cygwin: improve handling of .exe file extension
- Prefer the command name without `.exe` since the extension is optional
when launching application on Windows...
- ... but if the user started to type the extension, then use it.
- If there is no description and/or completion for `foo.exe` then
use those for `foo`

Closes #12100
2025-12-10 16:15:41 +01:00
Johannes Altmanninger
64196a2a9e complete: fix erasing wrapped functions
Two issues:
1. "complete -e foo" doesn't erase wrap definitions
2. "complete -e foo --wraps" erases things other than the wrap definitions

Fix them.

There's another issue, the second erase command leaves around an
extra complete entry. Let's leave that for later.

Fixes #12150
2025-12-10 16:15:41 +01:00
Johannes Altmanninger
0e9ceb154e fish_config theme dump: check for extra arguments 2025-12-10 16:15:41 +01:00
Daniel Rainer
64e3b419b6 ci: disable pexpect and tmux tests in sanitizer jobs
These tests are unreliable in CI when running with address sanitiation
enabled, resulting in intermittent CI failures.
Disable them to get rid of the many false positives to reduce annoyance
and to avoid desensitization regarding failures of the asan CI job.

Suggested in
https://github.com/fish-shell/fish-shell/pull/12132#issuecomment-3605639954

Closes #12142
Closes #12132
Closes #12126
2025-12-10 16:15:41 +01:00
Johannes Altmanninger
07389055f1 fish_indent: handle invalid arguments 2025-12-10 16:15:41 +01:00
Johannes Altmanninger
692e6d57cf fish_indent --ansi to emit SGR0 before final newline
Buggy programs parsing "fish_indent --ansi" output break because
we wemit SGR0 after the final newline.  I suppose this is weird,
and there's no need to wait until after the \n to emit SGR0 so let's
move it before that.

Closes #12096
2025-12-10 16:15:41 +01:00
Daniel Rainer
3e2336043a gettext-extract: fix race condition
Multiple gettext-extraction proc macro instances can run at the same
time due to Rust's compilation model. In the previous implementation,
where every instance appended to the same file, this has resulted in
corruption of the file. This was reported and discussed in
https://github.com/fish-shell/fish-shell/pull/11928#discussion_r2488047964
for the equivalent macro for Fluent message ID extraction. The
underlying problem is the same.

The best way we have found to avoid such race condition is to write each
entry to a new file, and concatenate them together before using them.
It's not a beautiful approach, but it should be fairly robust and
portable.

Closes #12125
2025-12-10 16:15:07 +01:00
Jesse Harwin
aa4ebd96f9 Fixed typo
Missed a spot in the first attempt #12135 as pointed out by [xtqqczze](https://github.com/fish-shell/fish-shell/pull/12135#issuecomment-3609441130)

Small typo found in doc_src/cmds/fish_opt.rst and tests/checks/argparse.fish. `valu` to `value`
2025-12-08 21:19:43 +08:00
Asuka Minato
656b39a0b3 Also show case-insensitive prefix matches in completion pager
[ja: made some changes and added commit message]

Fixes #7944
Closes #11910
2025-12-05 16:12:34 +01:00
Johannes Altmanninger
fceb600be5 math: remove logb
As discussed in #12112, this is a false friend (the libc logb()
does something else), and without keyword arguments or at least
function overloading, this is hard to read.
Better use "/ log(base)" trick.
2025-12-05 16:06:22 +01:00
PowerUser64
47c773300a feat(math): add logb function
Closes #12112
2025-11-30 09:20:33 +01:00
Daniel Rainer
2d29749eae printf: improve Unicode escape + PUA handling
The old handling of Unicode escape sequences seems partially obsolete
and unnecessarily complicated. For our purposes, Rust's u32 to char
parsing should be exactly what we want.

Due to fish treating certain code points specially, we need to check
if the provided character is among the special chars, and if so we need
to encode it using our PUA scheme. This was not done in the old code,
but is now.
Add tests for this.
Fixes #12081

Rework the error message for invalid code points.
The old message about invalid code points not yet being supported seems
odd. I don't think we should support this, so stop implying that we
might do so in the future.
In the new code, indicating that a Unicode character is
out of range is also not ideal, since the range is not contiguous.
E.g. `\uD800` is invalid, but \U0010FFFF is valid.
Refrain from referring to a "range" and instead just state that the
character is invalid.

Move formatting of the escape sequence into Rust's `format!` to simplify
porting to Fluent.

Closes #12118
2025-11-30 09:20:33 +01:00
Johannes Altmanninger
87a312ccba test/tmux-prompt: fix quoting that looks like a bug 2025-11-30 09:20:33 +01:00
Johannes Altmanninger
52286f087d builtins set: only one space between list elements 2025-11-30 09:20:33 +01:00
Johannes Altmanninger
7ca78e7178 share/functions: fix path to /bin/sh on android
As mentioned in https://github.com/fish-shell/fish-shell/issues/12055#issuecomment-3554869126

> instances of `/bin/sh` as freestanding commands within `.fish`
> files are most likely not automatically handled by `termux-exec`

and

> This topic is complicated by the fact that some Android ROMs _do_
> contain real `/bin/sh` files

Core uses /system/bin/sh on Android.  Let's do the same from script
(even if /bin/sh exists), for consistency.
2025-11-23 12:30:22 +01:00
Johannes Altmanninger
4ffa06fb7e Fix section names in suggested "help" commands
Fixes 2cd60077e6 (help: get section titles from Sphinx, 2025-11-05)
Fixes #12082
2025-11-23 12:30:22 +01:00
Johannes Altmanninger
a1baf97f54 Do not embed man pages in CMake builds
Commit 0709e4be8b (Use standalone code paths by default, 2025-10-26)
mainly wanted to embed internal functions to unbreak upgrade scenarios.

Embedding man pages in CMake has small-ish disadvantages:
1. extra space usage
2. less discoverability
3. a "cyclic" dependency:
   1. "sphinx-docs" depends on "fish_indent"
   2. "fish_indent" via "crates/build-man-pages" depends on "doc_src/".
   So every "touch doc_src/foo.rst && ninja -Cbuild sphinx-docs"
   re-builds fish, just to re-run sphinx-build.

The significant one is number 3.  It can be worked around by running
sphinx-build with stale "fish_indent" but I don't think we want to
do that.

Let's backtrack a little by stopping embedding man pages in CMake
builds; use the on-disk man pages (which we still install).

The remaining "regression" from 0709e4be8b is that "ninja -Cbuild
fish" needs to rebuild whenever anything in "share/" changes.  I don't
know if that's also annoying?

Since man pages for "build/fish" are not in share/, expose the exact
path as $__fish_man_dir.
2025-11-23 12:30:22 +01:00
Johannes Altmanninger
3b100fce2d Fix __fish_help_dir when running from build directory
When running fish from a CMake build directory ("build/fish"),
"__fish_help_dir" is wrong because we assume the tarball layout. Fix
that.
2025-11-23 12:30:22 +01:00
Johannes Altmanninger
0c67d0565a Commit help_sections data file
The help_sections.rs file was added to the tarball only as a quick hack.
There is a cyclic dependency between docs and fish:

"fish_indent" via "crates/build-man-pages" depends on "doc_src/".
So every "touch doc_src/foo.rst && ninja -Cbuild sphinx-docs"
re-builds fish.

In future "fish_indent" should not depend on "crates/build-man-pages".
Until then, a following commit wants to break this cyclic dependency
in a different way: we won't embed man pages (matching historical
behavior), which means that CMake builds won't need to run
sphinx-build.

But sphinx-build is also used for extracting help sections.

Also, the fix for #12082 will use help sections elsewhere in the code.

Prepare to remove the dependency on doc_src by committing the help
sections (we already do elsewhere).
2025-11-23 12:30:22 +01:00
Johannes Altmanninger
95aeb16ca2 Remove embed-data feature flag
This mode still has some problems (see the next commit) but having
it behind a feature flag doesn't serve us. Let's commit to the parts
we want to keep and drop anything that we don't want.

To reduce diff noise, use "if false" in the code paths used by man
pages; a following commit will use them.
2025-11-23 12:30:22 +01:00
Johannes Altmanninger
acae88e618 test tmux-first-prompt: disable in ASAN
Tracking issue: #11815
Closes #12084
2025-11-21 08:21:11 +01:00
Johannes Altmanninger
9165251a0b Feature flag for eventually disabling terminal workarounds
We've removed several terminal-specific workarounds but also added
some recently.  Most of the non-Apple issues have been reported
upstream.  Many of our workarounds were only meant to be temporary.
Some workarounds are unreliable and some can cause introduce other
problems.

Add a feature flag we can use later to let users turn off workarounds.

This doesn't disable anything yet, mostly because because despite being
off-by-default, this might surprise people who use "fish_features=all".
The fix would be "fish_features=all,no-omit-term-workarounds".
So we'd want a high degree of confidence.

For now we'll use this only with the next commit.

Closes #11819
2025-11-19 17:06:25 +01:00
Johannes Altmanninger
1bcfc64e13 status list-files: support multiple arguments
This fixes an issue in fish_config, see
ee94272eaf (commitcomment-170660405)
2025-11-19 16:36:14 +01:00
Johannes Altmanninger
289057f981 reset_abandoning_line: actually clear line on first prompt
Frequently when I launch a new shell and type away, my input is
echoed in the terminal before fish gets a chance to set shell modes
(turn off ECHO and put the terminal into non-canonical mode).

This means that fish assumption about the cursor x=0 is wrong, which
causes the prompt (here '$ ') to be draw at the wrong place, making
it look like this:

	ececho hello

This seems to have been introduced in 4.1.0 in a0e687965e (Fix
unsaved screen modification, 2025-01-14). Not sure how it wasn't a
problem before.

Fix this by clearing to the beginning of the line after turning off
ECHO but before we draw anything to the screen.

This turns this comment in the patch context into a true statement:

> This means that `printf %s foo; fish` will overwrite the `foo`

Note that this currently applies per-reader, so builtin "read" will
also clear the line before doing anything.
We could potentially change this in future, if we both
1. query the cursor x before we output anything
2. refactor the screen module to properly deal with x>0 states.

But even if we did that, it wouldn't change the fact that we want
to force x=0 if the cursor has only been moved due to ECHO, so I'm
not sure.
2025-11-16 11:47:47 +01:00
seg6
29024806e5 tests: minimum python version validation for user facing scripts
Adds [`Vermin`](https://github.com/netromdk/vermin) to make sure our
user facing Python scripts conform to the proper minimum Python version
requirements.

The tool parses Python code into an AST and checks it against a database
of rules covering Python 2.0-3.13.

Testing Python version compatibility is tricky because most issues only
show up at runtime. Type annotations like `str | None` (Python 3.10+)
compile just fine (under pyc) and they don't throw an exception until
you actually call the relevant function.

This makes it hard to catch compatibility bugs without running the code
(through all possible execution paths) on every Python version.

Signed-off-by: seg6 <hi@seg6.space>

Closes #12044
2025-11-16 11:21:18 +01:00
Johannes Altmanninger
e7d740785d tests/help-completions: fix for macOS awk 2025-11-10 10:15:48 +01:00
Johannes Altmanninger
8cc25fe772 tests/man: work around man idiosyncracy on macOS/FreeBSD
This man implementation fails to remove control characters when stdout
is not a TTY. Upstream tracking issue:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282414
2025-11-10 10:15:48 +01:00