Commit Graph

19444 Commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
d1a2923d72 Fix doc comments for CancelBehavior 2024-11-04 15:49:33 -06:00
Mahmoud Al-Qudsi
8aed929f5e Fix broken changelog formatting
Some checks failed
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Lock threads / lock (push) Has been cancelled
2024-11-03 13:53:42 -06:00
David Adam
e5040cbbaf CHANGELOG: work on 4.0.0
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
2024-11-03 22:43:25 +08:00
Peter Ammon
23941ea9ca
Don't try locking the history file if mmap returns ENODEV
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
If we try to memory map the history file, and we get back ENODEV meaning that
the underlying device does not support memory mapping, then treat that as a hint
that the filesystem is remote and disable history locking.
2024-11-02 12:09:51 -07:00
Peter Ammon
344b072e82
Further expand the list of filesystems considered remote
Incorporate additional file systems from
https://github.com/coreutils/gnulib/blob/master/lib/mountlist.c#L237-L253
by hunting down their magic numbers.

In the future we could consider switching to f_fstypename.
2024-11-02 11:59:34 -07:00
Johannes Altmanninger
cfcf415db7 Render overflown commandline in entirety just before executing
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
As of 04c913427 (Limit command line rendering to $LINES lines,
2024-10-25), we only render a part of the command line.  This removes
valuable information from scrollback.
The reasons for the limit were
1. to enable redrawing the commandline (can't do that if part of it
   is off-screen).
2. if the cursor is at the beginning of the command-line, we can't
   really render the off-screen suffix (unless we can tell the terminal
   to scroll back after doing that).

Fortunately these don't matter for the very last rendering of a
command line.  Let's render the entire command just before executing,
fixing the scrollback for executed commands.

In future, we should fix it also for pre-execution renderings. This
needs a terminal command to clear part of the scrollback.  Can't find
anything on https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
There is "Erase Saved Lines" but that deletes the entire scrollback.

See the discussion in #10827
2024-11-02 10:25:58 +01:00
Johannes Altmanninger
04d97e936a Remove redundant cursor position invariant check
Since f89909ae3 (Also handle overflown screens if editing pager search
field, 2024-10-27), cursor_arr is never None after the loop.
Assert that by unwrapping.

qa.sh
2024-11-02 10:16:45 +01:00
Johannes Altmanninger
f42beec42e Fix typo in comment 2024-11-02 10:13:37 +01:00
Johannes Altmanninger
85404bf7a9 edit_command_buffer: speed up setting cursor position by line/column
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
alt-e restores the cursor position received from the editor, moving by
one character at a time.  This can be super slow on large commandlines,
even on release builds.  Let's fix that by setting the coordinates
directly.
2024-11-01 20:09:55 +01:00
Johannes Altmanninger
6525e3d11a edit_command_buffer: silence error when editor reports out-of-bounds line number
This happens when using alt-e to edit the command buffer,
adding some lines, leaving the cursor at the end
and quitting the editor without saving.

Let's avoid the noisy error that has sort of bad rendering (would
need __fish_echo).
2024-11-01 20:09:55 +01:00
Johannes Altmanninger
3710e98d65 Suppress spurious error when config dir creation fails due to TOCTOU
Some checks failed
Rust checks / rustfmt (push) Has been cancelled
Rust checks / clippy (push) Has been cancelled
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / macos (push) Has been cancelled
Our recursive create_dir() first calls stat() to check if the directory
already exists and then mkdir() trying to create it. If another (fish)
process creates the same directory after our stat() but before our
mkdir(), then our mkdir() fails with EEXIST. This error is spurious
if there is already a directory at this path (and permissions are
correct).

Let's switch to the stdlib version, which promises to solve this issue.
They currently do it by running mkdir() first and ask stat() later.

This implies that they will only return success even if we don't have
any of rwx permissions on the directory, but that was already a problem
before this change. We silently don't write history in that case..

Fixes #10813
2024-10-31 08:01:31 +01:00
Josef Litoš
9e01981bb9 completions/adb: local files first when pushing
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
2024-10-31 01:05:44 +01:00
Johannes Altmanninger
cd3b6f9124 commandline --showing-suggestion to ignore single-space autosuggestion
Some checks are pending
make test / macos (push) Waiting to run
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
All-whitespace autocompletions are invisible, no matter the cursor
shape.  We do offer such autosuggestions after typing a command name
such as "fish". Since the autosuggestion is invisible it's probably
not useful. It also does no harm except when using a binding like

	bind ctrl-g '
	    if commandline --showing-suggestion
	        commandline -f accept-autosuggestion
	    else
	        up-or-search
	    end'

where typing "fish<ctrl-g>" surprisingly does not perform a history
search.  Fix this by detecting this specific case. In future we
could probably stop showing autosuggestions whenever they only
contain whitespace.
2024-10-30 06:25:27 +01:00
Johannes Altmanninger
ec939fb22f Work around BSD man calling pager when stdout is not a TTY
With BSD man, "PAGER=vim man man | cat" hangs because
[man](https://cgit.freebsd.org/src/tree/usr.bin/man/man.sh) wrongly
calls the pager even though stdout is not a terminal.

This hang manifests in places where we call apropos in a subshell,
such as in "complete -Ccar".

Let's work around this I guess. This should really be fixed upstream
because it's a problem in every app that wants to display man pages
but doesn't emulate a complete terminal.

Weirdly, the Apple derivative of man.sh uses WHATISPAGER instead
of MANPAGER.

Closes #10820
2024-10-30 04:58:50 +01:00
Johannes Altmanninger
31d7f197b1 Switch default build type back to RelWithDebInfo for now
Some checks failed
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / macos (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
Rust checks / clippy (push) Has been cancelled
A release build is recommended to most users (to avoid occasional slowness)
whereas developers may prefer debug builds for shorter build times and more
accurate debug information.

There are more users of "make install" than developers, so I think the
default should be optimized for users, i.e. an optimized build. I think
that's in line with what most of our peer projects do.

Even if developers don't know about the -DCMAKE_BUILD_TYPE=Debug
trick, they will likely be able to iterate quickly by using "cargo
{build,check,clippy,test}" and rust-analyzer, all of which use a debug
configuration by default, irrespective of cmake. Granted, users will need
to use cmake to run system tests. If a task needs a lot of iterations,
one can always convert the system test to a script that can be run with
target/build/fish. For building & running all system tests, the release
build takes 30% longer, so not that much.

Here are my build/test times and binary sizes; with debug:

    $ time ninja -C build-Debug/
    ________________________________________________________
    Executed in   25.30 secs    fish           external
       usr time   68.33 secs  676.00 micros   68.32 secs
       sys time   11.34 secs   41.00 micros   11.34 secs
    $ du -h build-Debug/fish
    43M	    build-Debug/fish
    $ time ninja -C build-Debug/ test
    ________________________________________________________
    Executed in  193.96 secs    fish           external
       usr time  182.84 secs    1.53 millis  182.83 secs
       sys time   30.97 secs    0.00 millis   30.97 secs

with release

    $ time ninja -C build-RelWithDebInfo/
    ________________________________________________________
    Executed in  106.80 secs    fish           external
       usr time  164.98 secs  631.00 micros  164.98 secs
       sys time   11.62 secs   41.00 micros   11.62 secs
    $ du -h build-RelWithDebInfo/fish
    4.6M	build-RelWithDebInfo/fish
    $ time ninja -C build-RelWithDebInfo/ test
    ________________________________________________________
    Executed in  249.87 secs    fish           external
       usr time  260.25 secs    1.43 millis  260.25 secs
       sys time   29.86 secs    0.00 millis   29.86 secs

Tangentially related, the numbers with "lto = true" deleted.  This seems
like a nice compromise for a default but I don't know much about the other
benefits of lto.

    $ time ninja -C build-RelWithDebInfo-thin-lto/
    ________________________________________________________
    Executed in   35.50 secs    fish           external
       usr time  196.93 secs    0.00 micros  196.93 secs
       sys time   13.00 secs  969.00 micros   13.00 secs
    $ du -h build-RelWithDebInfo-thin-lto/fish
    5.5M	build-RelWithDebInfo-thin-lto/fish
    $ time ninja -C build-RelWithDebInfo-thin-lto/ test
    ________________________________________________________
    Executed in  178.62 secs    fish           external
       usr time  287.48 secs  976.00 micros  287.48 secs
       sys time   28.75 secs  115.00 micros   28.75 secs

Alternative solution: have no default at all, and error out until the user
chooses a build type.
2024-10-28 14:26:57 +01:00
Johannes Altmanninger
dccc3349f0 Update build type recommendation to match our previous default
Currently the only difference between RelWithDebInfo and Release is that
the former adds -g (aka debuginfo=2) though it doesn't seem to make a lot
of difference in my testing.

Since build_tools/make_pkg.sh and debian/rules use RelWithDebInfo, let's be
consistent with those.
2024-10-28 14:26:57 +01:00
Peter Ammon
fa72d1faa1
Changelog fix for filesystem remote detection
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Add note about #10818
2024-10-27 21:30:29 -07:00
Peter Ammon
e322d3addc Expand the set of filesystems considered remote on Linux
Some background: fish has some files which should be updated atomically:
specifically the history file and the universal variables file. If two fish
processes modified these in-place at the same time, then that could result
in interleaved writes and corrupted files.

To prevent this, fish uses the write-to-adjacent-file-then-rename to
atomically swap in a new file (history is slightly more complicated than
this, for performance, but this remains true). This avoids corruption.

However if two fish processes attempt this at the same time, then one
process will win the race and the data from the other process will be lost.
To prevent this, fish attempts to take an (advisory) lock on the target
file before beginning this process. This prevents data loss because only
one fish instance can replace the target file at once. (fish checks to
ensure it's locked the right file).

However some filesystems, particularly remote file systems, may have locks
which hang for a long time, preventing the user from using their shell.
This is far more serious than data loss, which is not catastrophic: losing
a history item or variable is not a major deal. So fish just attempts to
skip locks on remote filesystems.

Unfortunately Linux does not have a good API for checking if a filesystem
is remote: the best you can do is check the file system's magic number
against a hard-coded list. Today, the list is NFS_SUPER_MAGIC,
SMB_SUPER_MAGIC, SMB2_MAGIC_NUMBER, and CIFS_MAGIC_NUMBER.

Expand it to AFS_SUPER_MAGIC, CODA_SUPER_MAGIC, NCP_SUPER_MAGIC,
NFS_SUPER_MAGIC, OCFS2_SUPER_MAGIC, SMB_SUPER_MAGIC, SMB2_MAGIC_NUMBER,
CIFS_MAGIC_NUMBER, V9FS_MAGIC which is believed to be exhaustive.

ALSO include FUSE_SUPER_MAGIC: if the user's home directory is some FUSE
filesystem, that's kind of sus and the fewer tricks we try to pull, the
better.
2024-10-27 21:10:45 -07:00
Peter Ammon
3e3aa08c28 Fix some dumb clippies
Some checks failed
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Lock threads / lock (push) Has been cancelled
2024-10-27 18:20:49 -07:00
Nihaal Sangha
5ee51492be Add tailscale completion 2024-10-27 16:49:00 -07:00
Giorgio Gallo
677e53f06a fix documentation for path normalize
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
2024-10-27 08:32:05 +00:00
Johannes Altmanninger
f89909ae31 Also handle overflown screens if editing pager search field
As mentioned in 04c913427 (Limit command line rendering to $LINES
lines, 2024-10-25) our rendering breaks when the command line overflows
the screen and we have a pager search field.

Let's also apply the overflow logic in this case.

Note that the search field still works, it's just not visible.

In future we should maybe show a small search field (~4 lines) in
this case (removing 4 screen lines worth of command line).  But again,
this is not really important.
2024-10-27 08:17:56 +01:00
Johannes Altmanninger
adfa87d141 Fix glitch rendering commandline that overflows screen size
If the first physical line in the command line overflows the screen,
the cursor will be wrong and we'll fail to clear the prompt without
a manual ctrl-l.  Let's fix that, and also don't print the OSC 133
marker in this case.

Currently, when we are scrolled, the first line on the screen still
gets an indentation that would normally be filled by the prompt.
This happens even for soft-wrapped lines, so they might be
torn apart in weird ways here.

In future, we might paint the prompt here.  If not, the current
behavior for soft-wrapped lines is debatable but its' not super
important to fix. The main goal is to first get rid of glitches in
these edge cases.
2024-10-27 07:16:30 +01:00
Johannes Altmanninger
c155acd004 Fix tmux-multiline-prompt test with EDITOR=vim
This test does "isolated-tmux send-keys Escape" to exit copy mode. When
EDITOR contains "vi", tmux will use Vi keybindings where Escape does
something else ("q" would exit copy mode).

Tests want to have predictable behavior so let's declare the default
emacs key bindings unconditionally.

Fixes #10812
2024-10-27 05:03:30 +01:00
Peter Ammon
2e2765eec0
Remove .cargo/config.toml
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
This added link args to target macOS 10.9, but these arguments are not necessary
when building via the make_pkg.sh script, and this file is causing other
problems.
2024-10-26 18:05:22 -07:00
Fabian Boehm
ca27e028df Silence unused imports for backports
Would be cool if there was a way to do this on future:: in general.
2024-10-26 22:28:37 +02:00
Fabian Boehm
0e62178320 Only apply kitty protocol MC hack in MC
This deactivated it everywhere
2024-10-26 22:24:22 +02:00
Johannes Altmanninger
bd9fee417b Use kitty keyboard protocol again for recent Midnight Commander
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
See https://midnight-commander.org/ticket/4597
2024-10-26 19:55:48 +02:00
Johannes Altmanninger
9ef76860e6 Default Vi cursor shapes for insert/replace mode
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Let's provide a sensible default here. Use a line for "insert" and an
underline for "replace_one" mode.  Neovim does the same, it feels pretty
slick.

As mentioned in #10806
2024-10-26 08:25:12 +02:00
Johannes Altmanninger
5760a1afcf Don't reset the fish_cursor_selection_mode in fish_default_key_bindings
As of the parent commit, __fish_vi_key_bindings_remove_handlers
should be working properly now, so this is no longer necessary That
function also cleans up other stuff like fish_cursor_end_mode, that
fish_default_key_bindings doesn't know anything about.

Also this fixes a spurious exit status of 4 in some scenarios.
2024-10-26 08:25:12 +02:00
Johannes Altmanninger
b05e071238 Properly remove Vi mode when switching to different bindings
fish_key_bindings may be set directly
or via fish_{default,vi}_key_bindings.

The latter use "set --no-event" to simplify their control
flow.  This (24836f965 (Use set --no-event in the key binding
functions, 2023-01-10)) broke Vi mode cleanup, since Vi mode
uses a variable hook.  Let's update this variable also when using
fish_{default,vi}_key_bindings.  Another reason to keep this variable
in sync is to make the fish_key_bindings handlers working as expected.
2024-10-26 08:22:19 +02:00
Johannes Altmanninger
8eaa16542a Extract function for changing key bindings 2024-10-26 08:21:12 +02:00
Johannes Altmanninger
832cda26f6 Fix external cursor not being restored on exiting Vi mode 2024-10-26 08:21:12 +02:00
Johannes Altmanninger
0e97b876ea Simplify fish_vi_cursor
This command has redundant source statements which need a lot
of escaping. Also, let's extract a function, to be modified in a
following commit.
2024-10-26 08:21:12 +02:00
Johannes Altmanninger
aca8058717 Remove obsolete optimization in default binding initialization
This special case was added in fb2ed355e (Improve fork reporting Save a
couple of forks during init, 2012-04-24) but the reason for it is gone.
2024-10-26 08:21:12 +02:00
Johannes Altmanninger
dea7841611 Fix Vi replace mode regression not being able to append to command line
Regressed in d51f66964 (Vi mode: avoid placing cursor beyond last
character, 2024-02-14).
2024-10-26 08:21:12 +02:00
Johannes Altmanninger
c2cde317f2 Remove stale FISH_UNIT_TESTS_RUNNING workaround
This exists to make sure our assertions pass independent of the
terminal but now we unconditionally print __fish_cursor_xterm.
2024-10-26 08:21:12 +02:00
Johannes Altmanninger
04c9134275 Limit command line rendering to $LINES lines
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Render the command line buffer only until the last line we can fit
on the screen.

If the cursor pushes the viewport such that neither the prompt nor
the first line of the command line buffer are visible, then we are
"scrolled". In this case we need to make sure to erase any leftover
prompt, so add a hack to disable the "shared_prefix" optimization
that tries to minimize redraws.

Down-arrow scrolls down only when on the last line, and up-arrow always
scrolls up as much as possible.  This is somewhat unconventional;
probably we should change the up-arrow behavior but I guess it's a
good idea to show the prompt whenever possible.  In future we could
solve that in a different way: we could keep the prompt visible even
if we're scrolled. This would work well because at least the left
prompt lives in a different column from the command line buffer.
However this assumption breaks when the first line in the command
line buffer is soft-wrapped, so keep this approach for now.

Note that we're still broken when complete-and-search or history-pager
try to draw a pager on top of an overfull screen.  Will try to fix
this later.

Closes #7296
2024-10-25 17:35:42 +02:00
Johannes Altmanninger
50333d8d00 Fix code duplication in commandline rendering
Will use this in the next commit.
2024-10-25 17:11:54 +02:00
Peter Ammon
0d5e6f356e
Correct spelling of "courtesy"
Some checks are pending
make test / macos (push) Waiting to run
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
2024-10-24 20:25:22 -07:00
Mahmoud Al-Qudsi
9c960d6af8 Fix number of characters consumed for VT200 mouse tracking
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
It's a 9-char CSI and we've read 3 (`<ESC>[T`), so we need to read six more.
Verified against the previous C++ codebase and couldn't find a reason for the
change to consuming 10 chars in a `git blame` run.
2024-10-24 11:22:52 -05:00
Mahmoud Al-Qudsi
daa2f2d023 Document max CSI parameter count 2024-10-24 10:36:00 -05:00
Mahmoud Al-Qudsi
21860cbd39 Fix panic parsing CSIs
The array lengths were transposed, so attempting to parse a CSI with more than 4
parameters would go out of bounds and panic.
2024-10-24 10:28:04 -05:00
Johannes Altmanninger
1b644226ec CHANGELOG: minor update
Some checks failed
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / macos (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
Rust checks / clippy (push) Has been cancelled
2024-10-22 08:55:08 +02:00
Johannes Altmanninger
d9633f2b38 Remove stale docs about fish_vi_force_cursor
Remove in 983746a69 (fish_vi_cursor: Remove terminal checks, 2024-08-30).
2024-10-21 21:53:32 +02:00
Johannes Altmanninger
5b249dbb41 test_env: remove stale env sanitization
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
These are unused since 983746a69 (fish_vi_cursor: Remove terminal checks,
2024-08-30).
2024-10-21 12:56:55 +02:00
Ilya Grigoriev
9c96ae0d40 ISSUE_TEMPLATE.md: Reset XDG_DATA_DIRS in suggested commands
This turned out to be relevant in https://github.com/fish-shell/fish-shell/issues/10800#issuecomment-2425170531 .
2024-10-21 12:54:43 +02:00
Johannes Altmanninger
2dbaf10c36 Also refresh TTY timestamps after external commands from bindings
Commit ba67d20b7 (Refresh TTY timestamps after nextd/prevd, 2024-10-13)
wasn't quite right because it also needs to fix it for arbitrary commands.

While at it, do this only when needed:
1. It seems to be only relevant for multiline prompts.
   Note that we can wait until after evaluation to check if the prompt is
   multiline, because repaint events go through the queue, see 5ba21cd29
   (Send repaint requests through the input queue again, 2024-04-19).
2. When the binding doesn't execute any external command, we probably don't
   need to fix up whatever the user printed. If they actually wanted to show
   output and print another prompt, they should currently use  "__fish_echo",
   to properly support multiline prompts. Bindings should produce no other
   output. What distinguishes external programs is that they can trigger this
   issue even if they don't  produce any output that remains visible in fish,
   namely by using the terminal's alternate screen.
   Would be nice if we could get rid of __fish_echo; I'm not yet sure how.

Fixes #10800
2024-10-21 12:13:00 +02:00
Johannes Altmanninger
30cba03bf9 Make SIGTERM handler async-signal-safe again
Some checks failed
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Lock threads / lock (push) Has been cancelled
2024-10-21 09:30:47 +02:00
Johannes Altmanninger
ae7b401029 completions/set: show innermost scope in variable description
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
A side effect of cd9e50c2c (completions/set: Complete variables of all scopes
when setting, 2024-10-03) is that

    HOME=$(mktemp -d) fish
    fish_config choose ayu\ Light
    set -S fish_color_

gives only completions that have the "Universal variable" description even
though most colors are also defined in the global scope which usually takes
precedence.

Fix this by reordering the completions. (The last-added completion is shown
first which is very surprising, we should change that).

This is not perfect; if the user has already specified `-U`, then we should
probably not show description of the global version.  But that's still
worth the trade that this commit makes.  Finally, the description could show
something like "Defined in universal and global scope" etc.
2024-10-20 07:55:04 +02:00