Commit Graph

18667 Commits

Author SHA1 Message Date
Fabian Boehm
6869b14fb5 docs: Add fish_should_add_to_history to commands list 2024-03-09 12:09:00 +01:00
Fabian Boehm
b03e727531 Remove unnecessary formatting 2024-03-09 12:06:24 +01:00
Fabian Boehm
f7cc1743c6
Allow deciding if a command should be saved to history (#10302)
Call fish_should_add_to_history to see if a command should be saved

If it returns 0, it will be saved, if it returns anything else, it
will be ephemeral.

It gets the right-trimmed text as the argument.

If it doesn't exist, we do the historical behavior of checking for a
leading space.

That means you can now turn that off by defining a
`fish_should_add_to_history` that just doesn't check it.

documentation based on #9298
2024-03-09 12:04:16 +01:00
Fabian Boehm
d91ad2976c Make fish_xgettext sorta work with rust
This is absolutely disgusting code, but it works out okay-ish.

The problem is xgettext has no rust support (it's stuck in review
limbo). So we use cargo-expand to extract all invocations of
gettext, and massage all that to generate a
messages.pot ourselves.

We also assume any string constant could be translated.
2024-03-09 11:48:29 +01:00
Fabian Boehm
97e7e730e1 Clean up two awkward wgettext_fmt invocations 2024-03-09 11:48:29 +01:00
Johannes Altmanninger
836ee93617 Vi bindings: Control-N to accept autosuggestion
One of the things that keep me from using Vi mode is that it doesn't define an
insert-mode shortcut to accept autosuggestions. Let's use Control-N because
that Vim key is the closest equivalent.

Closes #10339
2024-03-09 11:03:57 +01:00
QianChenglong
b3c610feff add completion for mycli
Closes #10309
2024-03-09 10:28:03 +01:00
Felix Luciano Salomon
90b9bce174 Added completion for ollama
Closes #10327
2024-03-09 10:28:03 +01:00
The0x539
1de7ebcf68 Simplify shared-from-this pattern 2024-03-09 10:09:03 +01:00
Peter Collingbourne
e5f83cd9a7 Fix logic for relocatable directory trees
The existing logic did not work because:

- Path::new("/foo/bar").ends_with("/bar") does not return true.
- PathBuf::shrink_to() only (potentially) reallocates the backing
  storage, and won't have an effect on the stored value.
2024-03-09 09:38:48 +01:00
Next Alone
a1d44a92be
fix: #10184 causes adb file completion failures (#10349)
Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com>
2024-03-08 21:56:37 -06:00
Johannes Altmanninger
6eddaa37af Revert "feat: adb completion cleared of awk"
It's broken,  see https://github.com/fish-shell/fish-shell/pull/10184
and doesn't really help I don't think.

This reverts commit ee837f254b.
2024-03-08 07:33:18 +01:00
John
b75e5ee823
remove repetitive words (#10348)
Signed-off-by: hishope <csqiye@126.com>
2024-03-07 18:35:41 -06:00
Mahmoud Al-Qudsi
80133c4bc6
Fix safety issues with some static variables (#10329)
Add safe Send/Sync wrapper for main thread data
2024-03-05 12:33:13 -06:00
TAKAHASHI Shuuji
3c7b2af442 docs: Correct default value of read function in read.rst 2024-03-04 17:49:47 +01:00
Fabian Boehm
d7adf8ef87 fixup! status again
Dangit I should double-check these
2024-03-04 17:10:13 +01:00
Fabian Boehm
1f43bbb449 fixup! fix status 2024-03-04 16:54:32 +01:00
Fabian Boehm
031dbb33b1 commandline: Borrow libdata later
builtin_print_help will end up borrowing it as mutable.

Fixes #10342
2024-03-04 16:53:51 +01:00
ridiculousfish
ff6fd699fe Fix a warning about an unused import on macOS 2024-03-03 14:12:59 -08:00
ridiculousfish
4396051449 Fix the history pager deletion test on macOS
It appears that the shift-delete key escape sequence is not being generated
because there's no mapping for it in screen-256color, causing the test to fail.
Switch to using f1 for the test.
2024-03-03 14:11:13 -08:00
Fabian Boehm
721a360707 cmake: Remove a bunch of unnecessary code
We are no longer C++, we no longer support xcode

Note: This will remove a warning "DO NOT EDIT" comment from __fish_build_paths.fish, but
that's unnecessary. The file is typically in /usr or another
package-manager-owned location, so people don't typically edit it.

And if it did we don't actually *care*, it'll work fine.
2024-03-03 20:36:24 +01:00
Johannes Altmanninger
33a7172ee8 Revert to not inserting control characters from keyboard input
As mentioned in the comment the historical behavior is because pressing unknown
control characters like Ctrl+4 inserts confusing characters, so let's back
out that part of b77d1d0e2 (Stop crashing on invalid Unicode input, 2024-02-27).

We still have the code for rendering control characters, for pasted text,
or text recalled from history. It is unclear whether we should strip those.
Some terminals already strip control characters from pasted text -- but not
all of them: see https://codeberg.org/dnkl/foot/pulls/312 for example which
has a follow up called "Don't strip HT when pasting in non-bracketed mode".
2024-03-02 23:31:08 +01:00
Fabian Boehm
2a4e776d92 Reimplement git version generation ourselves
This allows us to remove two dependency crates
2024-03-02 10:05:37 +01:00
Mahmoud Al-Qudsi
1ac17756c2 Also address safety issues with principal_parser() 2024-03-01 19:54:28 -06:00
Mahmoud Al-Qudsi
2ecbc56de9 Change MainThread<T> abstraction
Don't force the internal use of `RefCell<T>`, let the caller place that into
`MainThread<>` manually. This lets us remove the reference to `MainThread<>`
from the definition of `Screen` again and reduces the number of
`assert_is_main_thread()` calls.
2024-03-01 19:42:43 -06:00
zuisong
a1e46a94f6
Add --url-query completion for curl (#10332)
Add missing completion for curl's `--url-query` option
2024-02-29 12:09:51 -06:00
Mahmoud Al-Qudsi
5c94ebd095 Fix output::stdoutput() safety issues
Fairly straightforward, with the only unfortunate part of this being that
`Screen` isn't as pure and now encodes the facte that we use it with
main-thread-only stdout `Outputter`.
2024-02-29 11:29:37 -06:00
Mahmoud Al-Qudsi
f67ce2ac4b Add Sync/Send wrapper for main-thread-only data 2024-02-28 13:06:04 -06:00
Fabian Boehm
29af775390 abbr: Box the regex
The regex struct is pretty large at 560 bytes, with the entire
Abbreviation being 664 bytes.

If it's an "Option<Regex>", any abbr gets to pay the price. Boxing it
means abbrs without a regex are over 500 bytes smaller.
2024-02-28 18:48:24 +01:00
Fabian Boehm
3d1e8a6106 pager: Simplify some code 2024-02-28 18:34:57 +01:00
Fabian Boehm
31c2eb3f3c pager: Use selected color for parentheses if applicable
This always used pager_completion even for the selected one, now it
uses pager_selected_completion for that.

Fixes #10328
2024-02-28 18:14:05 +01:00
Fabian Boehm
5641ae71b8 ast: Box a large enum variant
IfStatement is 680 bytes, much larger than the other
variants (SwitchStatement is next at 232). An enum is as large as its
largest variant, so this saves a bunch, especially since
DecoratedStatement is much more likely than IfStatement.

This will speed up the no-execute benchmark by 1.07x.
2024-02-28 18:14:05 +01:00
Mahmoud Al-Qudsi
e7b94454df Add unsafety warnings
See https://github.com/rust-lang/rust/issues/114447
2024-02-28 10:09:53 -06:00
Mahmoud Al-Qudsi
5eb6b22fa4 Allow unused fns in ConcreteNodeMut 2024-02-28 09:44:11 -06:00
Mahmoud Al-Qudsi
50ff6b8a34 Remove using statements already imported by preludes 2024-02-28 09:41:51 -06:00
Johannes Altmanninger
b77d1d0e2b Stop crashing on invalid Unicode input
Unlike C++, Rust requires "char" to be a valid Unicode code point.  As a
workaround, we take the raw (probably UTF-8-encoded) input and convert each
input byte to a char representation from the private use area (see commit
3b15e995e (str2wcs: encode invalid Unicode characters in the private use
area, 2023-04-01)).  We convert back whenever we output the string, which
is correct as long as the encoding didn't change since the data was input.

We also need to convert keyboard input; do that.

Quick testing shows that our reader drops PUA characters.  Since this patch
converts both invalid Unicode input as well as PUA input into a safe PUA
representation, there's no longer a reason to not add PUA characters to
the commandline, so let's do that to restore traditional behavior.

Render them as � (REPLACEMENT CHARACTER); unfortunately we show one per
input byte instead of one per code point. To fix this we probably need our
own char type.

While at it, remove some special cases that try to prevent insertion of
control characters. I don't think they are necessary. Could be wrong..
2024-02-27 22:59:49 +01:00
Fabian Boehm
f60b6e6cd4 CHANGELOG 2024-02-27 16:28:20 +01:00
Fabian Boehm
78c9482822 Reformat share/**.fish with newlines collapsed 2024-02-27 16:25:01 +01:00
Fabian Boehm
f93a3e9e9b fish_indent: Collapse successive newlines
This makes it so code like

```fish
echo foo

echo bar
```

is collapsed into

```fish
echo foo

echo bar
```

One empty line is allowed, more is overkill.

We could also allow more than one for e.g. function endings.
2024-02-27 16:25:01 +01:00
Mathis Chenuet
73d760560b
Add completion for pstree (#10317)
* Add completion for pstree.fish

* use fish functions, much better
2024-02-26 17:39:11 +01:00
Fabian Boehm
f87c892ed8 Update cc dependency
Removes annoying "running cc --version" and such debug messages.
2024-02-26 16:17:47 +01:00
Fabian Boehm
d0cf07c4b3 Format __fish_cache_sourced_completions 2024-02-26 16:17:47 +01:00
may
66aab66670
add recent commits to completion for git diff (#10321) 2024-02-25 14:36:05 -06:00
Fabian Boehm
46b7e91c91 Update deps
Notably this removes the jobserver dependency
2024-02-24 10:07:47 +01:00
Fabian Boehm
f62f1aaf99 Remove remaining mentions of curses 2024-02-23 16:36:10 +01:00
Fabian Boehm
8712bd5a4b CHANGELOG terminfo 2024-02-22 20:15:24 +01:00
Fabian Boehm
c408342d65 CI: Install terminfo-db on FreeBSD 2024-02-22 20:10:16 +01:00
Fabian Boehm
da6a9bad5f Add additional paths for NetBSD and Nix
These seems weird to add upstream, and we might want to read
more here.
2024-02-22 20:10:16 +01:00
Fabian Boehm
785d784482 Make term warning less shouty
We don't need to know that it tried these five before finally getting
one, the list is *right there*.

It is also very unlikely that someone has "xterm" or "ansi" but not "xterm-256color"

For xterm-256color, we don't warn *at all* because we have that one hardcoded.
2024-02-22 20:10:16 +01:00
Fabian Boehm
75f7cda6ab Add xterm-256color fallback
And use it if $TERM is xterm-256color and could not be found, *without* warning.

These barely change, especially in the parts we use.
2024-02-22 20:10:16 +01:00