Commit Graph

18860 Commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
bcc1fc0167 rustup: add rustup target xxx completions 2024-05-04 18:42:11 -05:00
Johannes Altmanninger
4e816212a1 Check for unsupported "time &" in the proper place
This means we can detect this error also for simple blocks.

While at it do some cleanup in the area.
2024-05-03 09:37:56 +02:00
Johannes Altmanninger
a126d2aeba Revert "Remove redundant default escape delay"
I think given a local terminal running fish on a remote system, we can't
assume that an input sequence like \ea is sent all in one packet. (If we
could that would be perfect.)

Let's readd the default escape delay, to avoid a potential regression, but
make it only apply to raw escape bindings like "bind \e123". Treat sequences
like "bind escape,1,2,3" like regular sequences, so they can be bound on
all terminals.

This partially reverts commit b815319607.
2024-05-03 09:37:56 +02:00
Johannes Altmanninger
d855d1a2e6 Interpret escape as alt only if it's the escape byte
No need to take this code path when an unambiguous, prefix-free encoding is
used for the escape key.
2024-05-03 09:36:35 +02:00
Johannes Altmanninger
e1eeb3177e Silence clippy lint 2024-05-03 09:36:35 +02:00
Anurag Singh
4fa8d95b98 Move push_timer to measure command substitution timing too 2024-05-03 09:32:26 +02:00
Johannes Altmanninger
d4ecea56df Fix regression spuriously expanding abbr with cursor outside token
Given "abbr foo something", the input sequence

    foo<space><ctrl-z><space>

would re-expand the abbreviation on the second space which is surprising
because the cursor is not at or inside the command token.  This looks to be
a regression from 00432df42 (Trigger abbreviations after inserting process
separators, 2024-04-13)

Happily, 69583f303 (Allow restricting abbreviations to specific commands
(#10452), 2024-04-24) made some changes that mean the bad commit seems no
longer necessary. Not sure why it works but I'll take it.
2024-05-03 08:39:05 +02:00
Fabian Boehm
b5624f2e81 README: Update deps even more
I think we can now call what we have in git better than the last
C++-based release, and you'll still need a C compiler to build it
because we still have some C code (libc.c).
2024-05-02 19:44:43 +02:00
ClaXXX
0116dc5984
Fix the acidhub prompt for a commitless repository (#10462)
Deletes the error message generated by git when comparing indexes for a
commitless repository and print '-' as the branch name
2024-05-02 19:37:12 +02:00
Johannes Altmanninger
91b007cab7 Limit ctrl-r autofill/replace to a single command substitution
As reported on gitter, commands like "rm (...)" sometimes want a previous
command inside the parentheses. Let's try that.  If a user actually wants
to search for a command substitution they can move the cursor outside the
command substitution, or type the search string after pressing ctrl-r?
2024-05-01 20:21:18 +02:00
David Adam
a9078769c3 Update dependencies since RIIR is completed 2024-05-02 00:00:26 +08:00
fossdd
870c920a66 Upgrade to Alpine v3.19 and add cargo as dependency 2024-05-01 17:18:28 +02:00
Fabian Boehm
f551eeadfe Revert "Remove unused import"
It's not unused

This reverts commit 69fb620073.
2024-05-01 12:58:36 +02:00
Fabian Boehm
89b74a6983 Remove a few uses of unwrap 2024-05-01 12:58:29 +02:00
Johannes Altmanninger
69fb620073 Remove unused import 2024-05-01 12:53:00 +02:00
Johannes Altmanninger
0c413d0093 Use canonical key name in bind command 2024-05-01 12:53:00 +02:00
David Adam
5871deeee5 Debian packaging: drop Xenial support and bump debhelper compat
Discussed in https://github.com/fish-shell/fish-shell/issues/10453
2024-04-30 23:36:56 +08:00
David Adam
cc2fb5c07c fish.spec: drop RHEL/CentOS support
Discussed on https://github.com/fish-shell/fish-shell/issues/10453
2024-04-30 23:36:56 +08:00
David Adam
572aece169 RPM/Debian packaging: Rust build support 2024-04-30 23:36:56 +08:00
David Adam
e05bbe06ca build tools: add make_vendor_tarball script 2024-04-30 23:36:56 +08:00
Fabian Boehm
4be4592870 fish_add_path: Add separate message about files 2024-04-30 16:47:45 +02:00
Fabian Boehm
c43f7fbe9c tests: Add another sleep 2024-04-30 16:47:44 +02:00
Johannes Altmanninger
b00899179f Don't indent multi-line quoted strings; do indent inside ()
On a command with multiline quoted string like

    begin
        echo "line1
    line2"
    end

we actually indent line2 which seeems misleading because the indentation
changes the behavior when typed into a script.

This has become more prominent since commits
- a37629f86 (fish_clipboard_copy: indent multiline commands, 2024-04-13)
- 611a0572b (builtins type/functions: indent interactively-defined functions, 2024-04-12)
- 222673f33 (edit_command_buffer: send indented commandline to editor, 2024-04-12)

which add indentation to an exported commandline.

Never indent quoted strings, to make sure the rendering matches the semantics.
Note that we do need to indent the opening quote which is fine because
it's on the same line.

While at it, indent command substitutions recursively.  That feature should
also be added to fish_indent's formatting mode (which is the default).
Fortunately the formatting mode already works fine with quoted strings;
it does not indent them. Not sure how that's done and whether indentation
can use the same logic.
2024-04-30 14:12:48 +02:00
Johannes Altmanninger
2f6ed61833 parse_util_cmdsubst_extent to return an exclusive range
Given "1(23)4", this function returns an inclusive range, from the opening
to the closing parenthesis.  The subcommand is extracted by incrementing
the range start and interpreting the result as an exclusive range.

This is confusing, especially if we want to add multi-character quotes.
Change it to always return the full range (including parentheses) and provide
an easy way to access the command string.

While at it, switch to returning an enum.

This change is perhaps larger and more complex than necessary (sorry)
because it is mainly made with multi-character quotes in mind.  Let's see
if that works out.
2024-04-30 14:12:48 +02:00
Johannes Altmanninger
861feb7b46 Minor simplification in tokenizer 2024-04-30 14:00:06 +02:00
Johannes Altmanninger
dfd08a1a2c Run fish_indent on checks/expansion.fish 2024-04-30 14:00:06 +02:00
Johannes Altmanninger
29be454652 Move parse_util tests to separate file 2024-04-30 14:00:06 +02:00
Johannes Altmanninger
e7347b9581 Bind ctrl-Z to redo (since ctrl-z is undo)
In addition to the native Emacs undo binding, we also support ctrl-z.
On Linux, ctrl-shift-z alias ctrl-Z is the redo binding according to
https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts Let's bind allow
that.

Unfortunately ctrl-shift and ctrl-alt modified shortcuts on Linux may be
intercepted by the windowing system or the terminal. Only alt-shift seems to be
available reliably (but the shift bit should mean "extend selection" in Emacs).
2024-04-30 14:00:06 +02:00
Johannes Altmanninger
5756fa369f Changelog consistency improvement 2024-04-30 14:00:06 +02:00
Johannes Altmanninger
1185e5279e Don't print multiple summaries for multiline jobs
For example

    $ echo 'line
    line2' | sleep 1 &

    fish: Job 1, 'echo 'line' has ended
    fish: Job     line2' | sleep 1 &, '' has ended
2024-04-30 14:00:06 +02:00
Fabian Boehm
8639d7e450 Remove allow-unused-imports 2024-04-29 22:00:59 +02:00
Fabian Boehm
4d4ef7fa40 Remove backports for 1.67
This removes IsOkAnd and the is_some_and method.

I cannot actually find is_none_or in the stdlib?

I've kept the trait name to avoid changing it now and then later, maybe this should
be moved elsewhere to avoid claiming it's an stdlib thing?
2024-04-29 22:00:59 +02:00
Fabian Boehm
16fcc5de7c Increase MSRV to 1.70
It appears we can't find a system that ships rustc >= 1.67 and < 1.70,
so keeping it at 1.67 gains nothing.

1.70 is used in Debian 13, so that will be able to build fish out of
the box (12 was on 1.63 which was already too low).
2024-04-29 22:00:59 +02:00
Fabian Boehm
0aa588a129 CONTRIBUTING: Remove versions
These were outdated already (cmake). Let's keep them in the README for now.
2024-04-29 22:00:59 +02:00
Johannes Altmanninger
964d3fff15 Keep undo history across prompts
After abandoning a commandline (for example with ctrl-c) it's nice to be
able to restore it. There is little reason to discard the requisite undo
information, so keep it.
2024-04-29 09:20:09 +02:00
ridiculousfish
3afe0bb569 Remove LoopedRead and LoopedWrite
These were unused.
2024-04-28 11:15:48 -07:00
Fabian Boehm
55235a27d3 docs/abbr: Add --command to add subcommand synopsis 2024-04-28 11:33:27 +02:00
Johannes Altmanninger
a50419da1c Fix test_version.fish for Ubuntu Noble Numbat Docker build
git_version_gen fails on Noble Numbat because modern Git refuses
to read repo-local config if owned by another user.

    fishuser@a4263f53c93e:~/fish-build$ cd /fish-source/
    fishuser@a4263f53c93e:/fish-source$ git describe --always --dirty
    fatal: detected dubious ownership in repository at '/fish-source'
    To add an exception for this directory, call:

Allow reading it (though that doesn't seem necessary here, it would be better
to ignore it).
2024-04-28 10:38:26 +02:00
Johannes Altmanninger
5152f6534d Fix test_functions.fish for Ubuntu Noble Numbat Docker build
vared.fish is installed at
/home/fishuser/fish-build/test/buildroot/usr/local/share/fish/functions/vared.fish
as oppposed to being sourced from share/functions/.

I'm not 100% sure why this happens but it doesn't seem wrong.
2024-04-28 10:38:26 +02:00
Johannes Altmanninger
52ef919aee Require mandoc/nroff for print-help test
Ubuntu Noble Numbat doesn't install this by default.
2024-04-28 10:38:26 +02:00
Johannes Altmanninger
e20ce2efea Ubuntu Noble Numbat dockerfile
Currently pinned to rustc 1.75 but only because this is what we use on OBS.
2024-04-28 10:38:26 +02:00
Johannes Altmanninger
c0bcd817ba Remove obsolete bindings
iTerm2 supports CSI u so the custom bindings are no longer needed. Sequences
like \e\eOC are Escape followed by an SS3 arrow key which we can already
decode separately.
2024-04-28 10:38:26 +02:00
Mahmoud Al-Qudsi
40591ba629 Unify convert and magick completions 2024-04-27 11:45:54 -05:00
Jadi
6840ef46f7 Completion for magick (#10307)
In ImageMagick 7 or later, legacy commands have been replaced with
magick. Here a new functions, defines these completions and it is
called for `magick` and `magick convert`.

fixes #7172. Closes #10307.

Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
2024-04-27 11:45:12 -05:00
Fabian Boehm
2da5ce7a48 completions/conda: Enable file completions for --file options
Fixes #10463
2024-04-27 17:11:52 +02:00
Johannes Altmanninger
301e4d497e Make shift-delete also delete current autosuggestion
This is a bit more convenient than using "history delete".
2024-04-27 10:54:31 +02:00
Johannes Altmanninger
67197b4b07 Fix cleanup of autogenerated completions
We were inconsistent about this for no apparent reason.

Also cleaning up in ~/.config/fish/completions is
irrelevant by now since we moved to ~/.local/share/fish 8 years ago.

Now that the parent commit moved it again, cleaning up that one seems
reasonable.
2024-04-27 10:54:31 +02:00
Anurag Singh
62a8b48fd1 Move generated completions to cache directory 2024-04-27 10:39:30 +02:00
Fabian Boehm
1503be4287 parse_execution: Use an exhaustive match instead of an assert
This could also be "cancel", which we didn't check and instead
asserted out.
2024-04-27 08:19:00 +02:00
Johannes Altmanninger
fb99edae92 Stop using comma from command substitution in brace expansion
Fixes #5048
2024-04-26 18:15:47 +02:00