Commit graph

19291 commits

Author SHA1 Message Date
Johannes Altmanninger
ff47c2c628 Remove non-portable use of fstat
Part of #10634
2024-08-06 14:15:57 +02:00
Johannes Altmanninger
b64045dc18 Remove non-portable use of ino_t
Part of #10634
2024-08-06 14:15:03 +02:00
Johannes Altmanninger
fa4daeee0f Address clippy lint 2024-08-06 14:15:03 +02:00
Johannes Altmanninger
8fbe29ed7b Remove dead code 2024-08-06 14:15:03 +02:00
Johannes Altmanninger
7cfc6297bc Hack to make alt-{left,right} work again in iTerm2
iTerm2 deviates from protocol, so back out c3c832761 (Stop using stack for
kitty progressive enhancement, 2024-08-03) in that case.

Note that we use several ways of detecting iTerm2 (ITERM_PROFILE,
TERM_PROGRAM=iTerm.app, ITERM_SESSION_ID).
LC_TERMINAL seems superior because it works over ssh.

This new one should hopefully go away eventually.
2024-08-06 10:36:36 +02:00
Johannes Altmanninger
5acac84df9 Enable Cirrus CI again for some Linux targets
There are two failures remaining (focal-32bit and jammy-asan):
https://github.com/krobelus/fish-shell/runs/28339746247
2024-08-05 10:41:17 +02:00
Johannes Altmanninger
25724342e1 Cirrus: remove misplaced/redundant only_if 2024-08-05 10:41:17 +02:00
Johannes Altmanninger
4df0adefc8 Update docker files and cirrus config
- Ubuntu focal is the lowest LTS release that we can support with only
  distro packages (e.g. no rustup).
- Remove tsan from Cirrus (it's not working currently, and also not really
  important).
- Remove Centos (it passes tests but I'm not sure it's worth adding; there
  isn't even an official docker image for CentOS Stream).
2024-08-05 10:41:17 +02:00
Johannes Altmanninger
3984725b80 Fix tmux-complete test for old tmux versions
The CentOS Stream image I used provided tmux 2.7 which doesn't know about the
"Delete" alias.
2024-08-05 10:41:17 +02:00
Johannes Altmanninger
f033bccd3c Move fish build dir canonicalization into build.rs, to lower CMake version 2024-08-05 10:41:17 +02:00
Johannes Altmanninger
f71233ae02 Remove a CMake 3.19 construct
CONFIG supports multiple arguments only as of CMake 3.19, see
https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#configuration-expressions

Ubuntu focal ships with 3.16 by default, so enable building with that.
Note that there is also the workaround of installing "cmake-mozilla".
2024-08-05 10:41:17 +02:00
Johannes Altmanninger
615b413335 Mention in changelog that universal notifiers are not yet supported on BSD 2024-08-05 10:41:17 +02:00
Johannes Altmanninger
7c5f0fea1c Add test dependency (tmux) to builds.sr.ht specs 2024-08-05 10:41:17 +02:00
David Adam
8d8a036e20 add some reminders about the many places copyright information is kept 2024-08-04 21:11:21 +08:00
Kaley Main
70d0736b92 Tidy up Cargo.toml to better support packaging
Closes #10622.
2024-08-04 21:03:54 +08:00
Peter Ammon
1c38677db0
Minor cleanup of path_normalize_for_cd 2024-08-03 12:27:05 -07:00
Shaik Azhar Madar
b31b77cf83 Update p4.fish
add `--` for the string match command, so that if the `$line` has any `-`'s in it will be ignored
2024-08-03 10:52:48 -05:00
Johannes Altmanninger
c3c8327610 Stop using stack for kitty progressive enhancement
Today fish pushes/pops kitty progressive enhancements everytime control is
transfered to/from fish. This constitutes a regression relative to 3.7.1:

    $ fish
    $ ssh somehost fish
    (network disconnect, now we missed our chance to pop from the stack)
    $ bash # or some ncurses application etc
    (keyboard shortcuts like ctrl-p are broken)

When invoking bash, we pop one entry off the stack but there is another one.
There seems to be a simple solution: don't use the stack but always reset
the current set of flags.  Do that since I did not find a strong use case
for using the stack[1] (Note that it was recommended by terminal developers
to use the stack, so I might be wrong).

Note that there is still a regression if the outer shell is bash.

[1]: https://github.com/kovidgoyal/kitty/issues/7603#issuecomment-2256949384

Closes #10603
2024-08-03 17:51:48 +02:00
Amos Bird
041a26f647 Update TTY modes for external commands only after successful command
According to the discussion in #2315, we adopt TTY modes for external commands
mainly for "stty".  If our child process crashes (or SSH disconnect), we
might get weird modes. Let's ignore the modes in the failure case.

Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>

Part of #10603
2024-08-03 17:51:48 +02:00
Fabian Boehm
56a4ae17c9 docs: Make output not selectable
We already do this for the prompt
2024-08-03 16:26:34 +02:00
Johannes Altmanninger
e25a1358e6 Work around broken rendering of pasted multibyte chars in non-UTF-8-ish locale
Run

    printf \Xf6 | wl-copy # ö in ISO-8859-1
    LANG=de_DE LC_ALL=$LANG gnome-terminal -- build/fish

and press ctrl-v. The pasted data looks like this:

    $ set data (wl-paste -n 2>/dev/null | string collect -N)
    $ set -S data
    $data: set in local scope, unexported, with 1 elements
    $data[1]: |\Xf6|

we pass $data directly to "commandline -i", which is supposed to insert it
into the commandline verbatim. What's actually inserted is "�".

This is because of all of:
1. We never decode "\Xf6 -> ö" in this scenario. Decoding it -- like we do
   for non-pasted keyboard input -- would fix the issue.
2. We've switched to using Rust's char, which, for better or worse, disallows
   code points that are not valid in Unicode (see b77d1d0e2 (Stop crashing
   on invalid Unicode input, 2024-02-27)). This means that we don't simply
   store \Xf6 as '\u{00f6}'. Instead we use our PUA encoding trick, making it
   \u{f6f6} internally.
3. Finally, b77d1d0e2 renders reserved codepoints (which includes PUA chars)
   using the replacement character � (sic).  This was deemed more
   user-friendly than printing an invalid character (which is probably not
   mapped to a glyph).  Yet it causes problems here: since we think that
   \u{f6f6} is garbage, we try to render the replacement character. Apparently
   that one is not defined(?) in ISO-8859-1; we get "�".

Fix this regression by removing the replacement character feature.

In future we should maybe decode pasted input instead. We could do that
lazily in "commandline -i", or eagerly in "set data (wl-paste ...)".
2024-08-03 11:32:59 +02:00
David Adam
8b028c37e5 Bring licensing information up to date and synchronise across files 2024-08-03 00:14:48 +08:00
Johannes Altmanninger
d21ed0fb22 Disable terminal protocols before expanding wildcards
Commit 29f2da8d1 (Toggle terminal protocols lazily, 2024-05-16) made it so
the wildcard expansion in "echo **" (in a large directory tree) can't be
canceled with ctrl-c.  Fix this by disabling terminal protocols already at
expansion time (not waiting until execution).
2024-07-31 23:37:11 +02:00
Johannes Altmanninger
3be588569d Disable CSI u inside Midnight Commander for now
Using

    SHELL=$(command -v fish) mc

Midnight Commander will spawn a fish child with

    "function fish_prompt;"
    "echo \"$PWD\">&%d; fish_prompt_mc; kill -STOP %%self; end\n",

So fish_prompt will SIGSTOP itself using an uncatchable signal.

On ctrl-o, mc will send SIGCONT to give back control to the shell.
Another ctrl-o will be intercepted by mc to put the shell back to sleep.

Since mc wants to intercept at least ctrl-o -- also while fish is in control
-- we can't use the CSI u encoding until mc either understands that, or uses
a different way of passing control between mc and fish.

Let's disable it for now.

Note that mc still uses %self but we've added a feature flag
to disable that.  So if you use "set fish_features all"
you'll want to add a " no-remove-percent-self". A patch
to make mc use $fish_pid has been submitted upstream at
https://lists.midnight-commander.org/pipermail/mc-devel/2024-July/011226.html.

Closes #10640
2024-07-29 22:38:18 +02:00
Xiretza
fd006e02da Fix cd .. to the root directory
The leading slash always needs to be present, even if there aren't any other
components. This was introduced by the Rust port.
2024-07-29 10:23:29 -07:00
Peter Ammon
3d816174fd
Wildcard tree walking to only rely on dev, inode to detect changes
When applying a wildcard, it's important to keep track of the files that have
been visited, to avoid symlink loops. Previously fish used a FileId for the
purpose. However FileId also includes richer information like modification time;
thus if a file is modified during wildcard expansion then fish may believe that
the file is different and visit it twice.

The richer information like modification time is important for atomic file
writes but should be ignored for wildcard expansion; just use the (dev, inode)
pair instead.

This also somewhat reduces our reliance on struct stat, but we still need it for
fstatat which Rust does not expose.
2024-07-28 09:48:24 -07:00
Peter Ammon
89794ccfdb
Adopt fstat in screen.rs 2024-07-27 18:58:35 -07:00
Peter Ammon
3dc3aed991
Adopt fstat in file_id_for_fd 2024-07-27 18:58:34 -07:00
Peter Ammon
1332d33025
Introduce fstat() and adopt it in reader
Begin to migrate to Rust "native" Metadata, as part of addressing #10634

This will be structured as a series of small commits to aid bisecting.
2024-07-27 18:49:46 -07:00
Peter Ammon
0651ca0d9b
Unify FileId structs
We had two of these! Just use one.
2024-07-27 18:48:51 -07:00
EmilyGraceSeville7cf
4108306e45
feat: Yeoman support 2024-07-25 19:16:12 -07:00
Fabian Boehm
b3ed2f215b __fish_anyeditor: Add missing -- separator
My $EDITOR is set to "emacs" and "-nw", which breaks this
2024-07-23 17:04:23 +02:00
Johannes Altmanninger
c3cf3792f3 Expand tilde after brace expansion
Fixes #10610
2024-07-23 11:47:58 +02:00
Johannes Altmanninger
4e0cb5d3e9 __fish_seen_subcommand_from: don't clobber global variable 2024-07-23 11:47:58 +02:00
Johannes Altmanninger
6feec60a8e completions: don't treat token at cursor as flag 2024-07-23 11:47:58 +02:00
Johannes Altmanninger
a35c3d4d10 competions/clasp: add namespace to helper function 2024-07-23 11:47:58 +02:00
Johannes Altmanninger
82639d274e string-replace.rst: fix trailing whitespace 2024-07-23 11:47:58 +02:00
Peter Ammon
ff72080aac
Changelog fix for #10624 2024-07-21 19:20:46 -07:00
Dezhi Wu
7308dbc7ad fish_indent: Prevent overwriting file with identical content
Fixes #10616
2024-07-21 18:57:48 +08:00
Lzu Tao
d9e5c6527f
Add description for git log -L 2024-07-20 13:54:21 -07:00
Mahmoud Al-Qudsi
fe63775ec5 string: Also escape new lines with --style=regex
This isn't *required* in the PCRE2 spec but it greatly increases the utility of
escaped regex strings at the commandline.
2024-07-16 17:05:11 -05:00
Mahmoud Al-Qudsi
6020fc497a Patch __fish_seen_argument to support --foo=arg
...when searching for long arguments by name/key.

Closes #10615.
2024-07-14 21:05:52 -05:00
Mahmoud Al-Qudsi
936f7d9b8d Add pexpect test for commandline --showing-suggestion 2024-07-07 22:34:36 -05:00
Mahmoud Al-Qudsi
b93e52079b Document commandine --showing-suggestion 2024-07-07 22:34:36 -05:00
Mahmoud Al-Qudsi
faf3b356f2 Add commandline --showing-suggestion
Returns 0 (true) in case an autosuggestion is currently being displayed.

This was first requested in #5000 then again in #10580 after the existing
workaround for this missing functionality was broken as part of a change to the
overall behavior of `commandline` (for the better).
2024-07-07 22:34:36 -05:00
Mahmoud Al-Qudsi
4730a04f25 Use NonZero types for 1-based line numbers
Since we have a mix of both 0-based and 1-based line numbers in the code base,
we can now distinguish between them by type alone. Also stop using 0 as a
placeholder value for "no line number available" except in explicit helper
functions such as `get_lineno_for_display()`.
2024-07-07 20:58:09 -05:00
Mahmoud Al-Qudsi
92cae9b576 Reduce size of Block to 32 bytes
Using a 32-bit integer to store the line number, as previously discussed.
2024-07-07 20:37:04 -05:00
Peter Ammon
9edd0cf8ee
Remove some now unused CMake bits 2024-07-07 16:06:45 -07:00
Peter Ammon
925382dc3e
Make make_pkg.sh create fat binaries again on macOS 2024-07-07 14:53:17 -07:00
Peter Ammon
c90862cd3d
Remove legacy Mac.cmake 2024-07-07 12:25:47 -07:00