Commit Graph

17848 Commits

Author SHA1 Message Date
Fabian Boehm
3ce67ecbd2 printf: Fix octal escapes with leading zeroes
Octal escapes can be written as `\057` or as `\0057`.

Simply ported wrong initially.
2023-10-05 15:39:50 +02:00
Fabian Boehm
8cc0bdeed8 pexpect: Remove some unnecessary empty lines
This strips the newline from "code_context" (which is really just the
called function), and from the unescaped output.

Rather, in case the output doesn't end with a newline it'll mark it
with an explicit message "(no trailing newline)".
2023-10-04 18:51:44 +02:00
Fabian Boehm
7a22dcb687 pexpect: Check if the process exited with a signal
This would have been helpful in #10044:

> signals.py:28: SIGNAL SIGSEGV from expect_prompt()

instead of "EOF".
2023-10-04 16:02:13 +02:00
Fabian Boehm
f8e38819a5 open: Don't run xdg-open in the background
This was introduced as a workaround to #7215 - xdg-open's generic path
wouldn't background graphical apps.

This has been fixed a month ago in xdg-open, so we can stop doing it.

The good news is this also allows terminal apps to be used again, so
it

Fixes #10045
2023-10-04 15:57:32 +02:00
Hauke Strasdat
4ab34f2e86 fix: don't make assumptions about signedness of libc::c_char 2023-10-01 13:27:10 -07:00
Xiretza
0cdf801d0b completions/pacman: fix -Qp completing packages, not files
--file/-p makes -Q interpret the command line argument as a package file
rather than a package name.
2023-10-01 08:46:33 +02:00
Kevin F. Konrad
269c9c3f0c
add completions for crc and oc (#10034) 2023-10-01 08:38:27 +02:00
Roland Fredenhagen
e6bef40c22
completions: add watchexec (#10027)
* completions: add watchexec

* review
2023-10-01 08:37:42 +02:00
Fabian Boehm
10d91b0249 screen: Unset color at the end of a line even without clr_eol
This is a sensible thing to do, and fixes some cases where we're
state-dependent.

E.g. this fixes the case in the pager where some things are bold and
some aren't, because that bolding is (rather awkwardly) implicitly
triggered when we have a background, and so we don't notice we need to
re-do that bolding after we moved to the next line because we think we
still have the same color.

Fixes #9617
2023-09-30 15:32:54 +02:00
Gregory Anders
b32cc65166 Do not use is_some_and
This was stabilized in Rust 1.70.0, but CI uses 1.67.0 where this function was
still marked unstable.
2023-09-30 10:09:52 +02:00
Gregory Anders
33c6eee9d2 Check terminfo for ts capability to determine title setting support 2023-09-30 10:09:52 +02:00
Fabian Boehm
ff8a79a823 Add a test for fish_add_path with relative paths 2023-09-29 16:54:23 +02:00
Fabian Boehm
9fa70d3ace Remove two calls to builtin realpath
path was added in 3.4, it's old enough that we can use it now.
2023-09-29 16:47:00 +02:00
Fabian Boehm
35baa88334 cmake: Canonicalize binary dir
This would otherwise fail to set $fish_function_path to
share/functions etc if run through a symlink.
2023-09-28 17:34:10 +02:00
Charlotte
7c5777a82a completions/pkill: use locals. 2023-09-27 19:53:17 +02:00
David Adam
4fab9e525a drop now-unused postfork C++ module 2023-09-25 21:47:19 +08:00
ridiculousfish
555171cb55 Adopt Rust postfork code
This adopts the Rust postfork code, bridging it from C++ exec module.

We use direct function calls for the bridge, rather than cxx/autocxx, so that we
can be sure that no memory allocations or other shenanigans are happening.
2023-09-24 13:04:00 -07:00
ridiculousfish
c862a06874 Implement postfork code in Rust
This implements the "postfork" code in Rust, including calling fork(),
exec(), and all the bits that have to happen in between. postfork lives
in the fork_exec module.

It is not yet adopted.
2023-09-24 13:04:00 -07:00
ridiculousfish
c5d770c78a Introduce flog_safe module in fork_exec module
This introduces a new module called fork_exec, which will be for posix_spawn,
postfork, and flog_safe - stuff concerned with actually executing binaries,
and error reporting.

Add a FLOG_SAFE! macro which writes errors to the flog fd in an
async-signal-safe way. This implementation differs from the C++ in that we
allow printing integers directly - no requiring them to be converted to a
buffer first.
2023-09-24 13:04:00 -07:00
ridiculousfish
6a6cde50d5 Stop using widestrs macro in flog
Use L! directly. Fewer proc-macros is good.
2023-09-24 13:04:00 -07:00
NextAlone
3bcde90a88
completion(loginctl): complete sessions, users, seats (#10023)
* completion(loginctl): complete sessions, users, seats
* fix: rename functions and use builtin to parse strings
* fix: duplicate commands
2023-09-23 22:49:43 +02:00
Fabian Boehm
e682ffaf11 Add doctl completion
Just calling a generation thing
2023-09-23 15:09:59 +02:00
Fabian Boehm
2cf22596e7 Disable reflow handling for WezTerm too
Seems to work fine
2023-09-22 17:13:28 +02:00
Fabian Boehm
4d2f7b0c0d
ast: Require --help to parse more keywords as decorated statement (#10000)
This makes it so

```fish
if -e foo
    # do something
end
```

complains about `-e` not being a command instead of `end` being used
outside of an if-block.

That means both that `-e` could now be used as a command name (it
already can outside of `if`!) *and* that we get a better error!

The only way to get `if` to be a decorated statement now is to use `if
-h` or `if --help` specifically (with a literal option).

The same goes for switch, while and begin.

It would be possible, alternatively, to disallow `if -e` and point
towards using `test` instead, but the "unknown command" message should
already point towards using `test` more than pointing at the
"end" (that might be quite far away).
2023-09-19 17:34:13 +02:00
Fabian Boehm
6194899c6b tests: Remove a misunderstanding 2023-09-15 20:04:13 +02:00
Henrik Hørlück Berg
731f06bdb9 fixup! Forward-port #9931 2023-09-15 15:10:14 +02:00
Johannes Altmanninger
280e72c152
Merge pull request #9916 from henrikhorluck/riir/wildcard
Port wildcard to Rust
2023-09-15 15:02:55 +02:00
Henrik Hørlück Berg
0cc1aef725
Forward-port #9931 2023-09-15 14:58:54 +02:00
Henrik Hørlück Berg
6ee81c0f15
Crash if invariant is broken 2023-09-15 14:46:53 +02:00
Henrik Hørlück Berg
5407d0b785
Apply code review fixes 2023-09-15 14:44:58 +02:00
Henrik Hørlück Berg
d6a9ad66a7
Allow CancelChecker to be FnMut 2023-09-15 14:44:58 +02:00
Henrik Hørlück Berg
d277a50564
Combine previous attempt into this
*singing it's the best of both worlds*
2023-09-15 14:44:58 +02:00
Henrik Hørlück Berg
e0bbf3eee9
Port wilcard.{cpp,h} to Rust
- This is untested and unused, string ownership is very much subject to change
- Ports the minimally necessary parts of complete.rs as well
- This should fix an infinite loop in `create_directory` in `path.rs`, the first
  `wstat` loop only breaks if it fails with an error that's different from
  EAGAIN
2023-09-15 14:44:58 +02:00
Henrik Hørlück Berg
80d92dcc6d
Port the easy part of wildcard.{h,cpp}
- wildcard_match is now closer to the original that is linked in a comment, as
  pointer-arithmetic translates very poorly. The act of calling wildcard
  patterns wc or wildcard is kinda confusing when wc elsewhere is widechar.
2023-09-15 14:38:30 +02:00
Johannes Altmanninger
e1f5751ba0 fixup! builtin status: use program name constant again 2023-09-14 20:46:42 +02:00
Johannes Altmanninger
61d506afd0 builtin status: use program name constant again 2023-09-14 20:42:25 +02:00
Johannes Altmanninger
e2ee8a0beb isolated-tmux: fix quoting error 2023-09-14 20:42:25 +02:00
Fabian Boehm
ebb8368464 docs/read: Some reorganization
This just had *all the options* in one gigantic list, and some very
stuffy wording - "prompt-str" sounded like it was discouraged for some reason?
2023-09-13 17:18:19 +02:00
Fabian Boehm
ad54f07328 docs/set: Correct some errors 2023-09-13 17:08:52 +02:00
Fabian Boehm
778f4e6732 docs: Improve quoting variables section
This now specifically explains quoting with `set`, and the contrast to bash.
2023-09-11 17:31:00 +02:00
Fabian Boehm
136dc6ce28 Test for mktemp completion
Turns out fish isn't in $PATH on the CI systems
2023-09-11 16:52:38 +02:00
Fabian Boehm
110de8e0df Harden test
Turns out the order wasn't the same on CI as it was on my system. Just
match it.
2023-09-10 20:56:58 +02:00
Fabian Boehm
b03327f5d2 __fish_complete_command: Fix --foo= logic
This was already supposed to handle `--foo=bar<TAB>` cases, except it
printed the `--foo=` again, causing fish to take that as part of the
token.

See #9538 for a similar thing with __fish_complete_directories.

Fixes #10011
2023-09-10 18:16:41 +02:00
Fabian Boehm
fc95eca257 share/config.fish: Skip __fish_set_locale if $LANG is already set
This is the most common and sensible env var, we check it outside,
so we can skip loading the function at all if we already know it's not
gonna do anything.

This is done on every startup of every single fish, and it saves ~0.2ms.
2023-09-09 15:53:20 +02:00
Marcelo Mendes Spessoto Junior
7534572d99 Shortening node.fish completions
Signed-off-by: Marcelo Mendes Spessoto Junior <marcelospe@shinji.linux.ime.usp.br>
2023-09-09 08:31:19 +02:00
Jason Nader
d6e234c60c
completions: add ibmcloud (#10004)
* completions: add ibmcloud

* Update ibmcloud.fish
2023-09-09 08:30:16 +02:00
Asuka Minato
3bf80b2374
add gcc completion for link lib (#10007)
* add completion for lib

* use path basename && use -a
2023-09-09 08:29:39 +02:00
Fabian Boehm
5b44c26a19 reader: Use existing search string when opening the history pager
I sometimes find myself doing something like this:

- Look for a commandline that includes "echo" (as an example)
- Type echo, press up a few times
- I can't immediately find what I'm looking for
- Press ctrl-r to open up the history pager
- It uses the current commandline as the search string,
  so now I'm looking for "echo foobar"

This makes it so if the search string already is in use, that's what
the history-pager picks as the initial search string.
2023-09-09 08:29:24 +02:00
Fabian Boehm
0e81d25b36 docs/commandline: Add more on the -oc/-ct thing
This was the remaining immediately actionable part of #7375.

It's not definitely the last word, but a change here would require a
bigger plan.

Fixes #7375
2023-09-08 18:27:34 +02:00
Fabian Boehm
180692fb29 completion: Set up wrapping for gw/gradlew
These were set up as commands in the actual gradle completions, but
they would never be loaded.
2023-09-07 08:06:55 +02:00