Commit Graph

18697 Commits

Author SHA1 Message Date
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
Fabian Boehm
8c86336109 Remove useless use of cstring 2024-02-22 20:10:16 +01:00
Fabian Boehm
57317fdaf2 Remove now unused assert helpers 2024-02-22 20:10:16 +01:00
Fabian Boehm
fc794bab4c Switch to the terminfo crate
This allows us to get the terminfo information without linking against curses.

That means we can get by without a bunch of awkward C-API trickery.

There is no global "cur_term" kept by a library for us that we need to invalidate.

Note that it still requires a "unhashed terminfo database", and I don't know how well it handles termcap.

I am not actually sure if there are systems that *can't* have terminfo, everything I looked at
has the ncurses terminfo available to install at least.
2024-02-22 20:10:16 +01:00
Mahmoud Al-Qudsi
2c2ab0c1fa
Always source file after funced (#10318)
... even if the file hasn't changed. This addresses an oddity in the following
case:

* Shell is started,
* function `foo` is sourced from foo.fish
* foo.fish is *externally* edited and saved
* <Loaded definition of `foo` is now stale, but fish is unaware>
* `funced foo` loads `type -p foo` showing changed definition, user exits
  $EDITOR saving no changes (or with $status 0, more generally).
* Stale definition of `foo` remains
2024-02-22 12:45:20 -06:00
Jadi
e207f8464e Make descriptions shorter: iex, jhipster, lpadmin, mocp, rmmod 2024-02-22 18:59:08 +01:00
Jason Nader
fc58b9c68f completions: add ssh -D option 2024-02-22 18:58:04 +01:00
Paul Gier
6c9c033126 functions: handle hostname starting with dash
If a hostname starts with a dash `-` character, the prompt_hostname function
fails because the `string` function interprets it as an option instead
of an argument.
2024-02-22 21:21:31 +08:00
Jason Nader
2f332f0019 completions: update 'echo' 2024-02-20 17:40:35 +01:00
Fabian Boehm
b7cc7db93c fish_key_reader: Remove unnecessary parser
I have no idea what this would be used for, it's instantiated, we set
is_interactive, and then we never use it.
2024-02-20 16:55:32 +01:00
Fabian Boehm
9a2729d298 Fix builtin read crash with negative nchars
Also make it simpler by just passing it along as a usize
2024-02-19 18:48:21 +01:00
Fabian Boehm
8667ed5c17 fish_git_prompt: Count type changes as dirty too
Fixes #10305
2024-02-17 08:37:22 +01:00
Johannes Altmanninger
b687ef036b Fix regression of C-e always accepting autosuggestion 2024-02-17 01:34:32 +01:00
Johannes Altmanninger
8c91d1421a Add some sleeps to fix the tmux-history-search test 2024-02-17 01:33:29 +01:00
Fabian Boehm
0d9c737a47 builtins/history: Remove unnecessary unwrap 2024-02-16 19:40:42 +01:00
Fabian Boehm
46afbea72b exec: Pass some cstrs as cstr instead of converting to ptr and back 2024-02-16 19:40:41 +01:00
Fabian Boehm
7e8a4dbe5c highlight: Stop copying pending variables 2024-02-16 19:40:41 +01:00
Fabian Boehm
1160bf84ed input: Resolve a TODO 2024-02-16 19:40:39 +01:00
Fabian Boehm
035948eb2f Correct and shorten a comment
There is no more "input.cpp"
2024-02-16 19:11:45 +01:00
Fabian Boehm
983af732dd Add test for history pager crash 2024-02-16 18:43:16 +01:00
Fabian Boehm
9ff02d6a7f Fix crash in the history pager
Delete the last shown entry and it'll subtract with overflow
2024-02-16 18:22:37 +01:00