Commit graph

18118 commits

Author SHA1 Message Date
Florian Meißner
b16a869907 Fix typo in read doc 2023-10-18 19:09:11 +02:00
exploide
5d0efbf2e8 completions: added userdel from shadow-utils 2023-10-18 19:08:50 +02:00
Oliver Schrenk
631f2c073c fix typo in set -U option 2023-10-18 19:08:09 +02:00
NextAlone
7250e6fa6a
completion(loginctl): fix sessions with ssh or other states (#10038)
Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
2023-10-18 18:36:54 +02:00
Fabian Boehm
913eddbdcf docs: Underline *all* body links, not just internal ones 2023-10-18 18:35:02 +02:00
Fabian Boehm
c883d73145 Work on 3.7.0 CHANGELOG 2023-10-17 17:49:34 +02:00
Johannes Altmanninger
211a3ceee1 Copy history pager search field to command line on Enter if no match
Closes #9934

(cherry picked from commit b7f7dcf788)
2023-10-17 17:34:40 +02:00
Johannes Altmanninger
64bff1a51c history pager: delete selected history entry with Shift-Delete
After accidentally running a command that includes a pasted password, I want
to delete command from history. Today we need to recall or type (part of)
that command and type "history delete".  Let's maybe add a shortcut to do
this from the history pager.

The current shortcut is Shift+Delete. I don't think that's very discoverable,
maybe we should use Delete instead (but only if the cursor is at the end of
the commandline, otherwise delete a char).

Closes #9454

(cherry picked from commit 052823c120)
2023-10-17 17:25:11 +02:00
Eddie Lebow
e1c2a4e50c Include subsequence matches in history-pager
If a `contains` search yields no results, try again with `contains_subsequence`.

(cherry picked from commit 00692bcdfe)
2023-10-17 17:04:25 +02:00
ridiculousfish
7fa3dd1747 Refresh and fix some web config bugs
Refresh some stale CSS, improve some rendering, and fix some bugs.

Some of the CSS no longer applied. Remove the bright red X in history
and use a tamer color. Fix the prev/next paginator buttons from moving
for large paginations. Fix the calculation about disabling prev/next.
2023-10-15 13:00:26 -07:00
Fabian Boehm
85c03e4b67 wildcard: Rationalize file/command completions (#10052)
* wildcard: Remove file size from the description

We no longer add descriptions for normal file completions, so this was
only ever reached if this was a command completion, and then it was
only added if the file wasn't a regular file... in which case it can't
be an executable.

So this was dead.

* Make possible_link() a maybe

This gives us the full information, not just "no" or "maybe"

* wildcard: Rationalize file/command completions

This keeps the entry_t as long as possible, and asks it, so especially
on systems with working d_type we can get by without a single stat in
most cases.

Then it guts file_get_desc, because that is only used for command
completions - we have been disabling file descriptions for *years*,
and so this is never called there.

That means we have no need to print descriptions about e.g. broken symlinks, because those are not executable.

Put together, what this means is that we, in most cases, only do
an *access(2)* call instead of a stat, because that might be checking
more permissions.

So we have the following constellations:

- If we have d_type:
  - We need a stat() for every _symlink_ to get the type (e.g. dir or regular)
    (this is for most symlinks, if we want to know if it's a dir or executable)
  - We need an access() for every file for executables
- If we do not have d_type:
  - We need a stat() for every file
  - We need an lstat() for every file if we do descriptions
    (i.e. just for command completion)
  - We need an access() for every file for executables

As opposed to the current way, where every file gets one lstat whether
with d_type or not, and an additional stat() for links, *and* an
access.

So we go from two syscalls to one for executables.

* Some more comments

* rust link option

* rust remove size

* rust accessovaganza

* Check for .dll first for WSL

This saves quite a few checks if e.g. System32 is in $PATH (which it
is if you inherit windows paths, IIRC).

Note: Our WSL check currently fails for WSL2, where this would
be *more* important because of how abysmal the filesystem performance
on that is.
2023-10-14 08:46:14 +02:00
Fabian Boehm
0f8bcb0414
wildcard: Rationalize file/command completions (#10052)
* wildcard: Remove file size from the description

We no longer add descriptions for normal file completions, so this was
only ever reached if this was a command completion, and then it was
only added if the file wasn't a regular file... in which case it can't
be an executable.

So this was dead.

* Make possible_link() a maybe

This gives us the full information, not just "no" or "maybe"

* wildcard: Rationalize file/command completions

This keeps the entry_t as long as possible, and asks it, so especially
on systems with working d_type we can get by without a single stat in
most cases.

Then it guts file_get_desc, because that is only used for command
completions - we have been disabling file descriptions for *years*,
and so this is never called there.

That means we have no need to print descriptions about e.g. broken symlinks, because those are not executable.

Put together, what this means is that we, in most cases, only do
an *access(2)* call instead of a stat, because that might be checking
more permissions.

So we have the following constellations:

- If we have d_type:
  - We need a stat() for every _symlink_ to get the type (e.g. dir or regular)
    (this is for most symlinks, if we want to know if it's a dir or executable)
  - We need an access() for every file for executables
- If we do not have d_type:
  - We need a stat() for every file
  - We need an lstat() for every file if we do descriptions
    (i.e. just for command completion)
  - We need an access() for every file for executables

As opposed to the current way, where every file gets one lstat whether
with d_type or not, and an additional stat() for links, *and* an
access.

So we go from two syscalls to one for executables.

* Some more comments

* rust link option

* rust remove size

* rust accessovaganza

* Check for .dll first for WSL

This saves quite a few checks if e.g. System32 is in $PATH (which it
is if you inherit windows paths, IIRC).

Note: Our WSL check currently fails for WSL2, where this would
be *more* important because of how abysmal the filesystem performance
on that is.
2023-10-14 08:45:15 +02:00
Johannes Altmanninger
773a507b01 fish.rs: fix regression in fish_xdm_login_hack_hack_hack_hack
This is off by one from the C++ version.

It wasn't super obvious why this worked in the first place.
Looks like args[0] is "-" because we are invoked like

    fish -c 'exec "${@}"' - "${@}"

and it looks like "-" is treated like "--" by bash, so we emulate that.
See https://github.com/fish-shell/fish-shell/issues/367#issuecomment-11740812
2023-10-13 19:58:50 +02:00
Johannes Altmanninger
b8c5627eb1 io: use Vec::with_capacity 2023-10-13 19:53:45 +02:00
Fabian Boehm
c6e905a1b9 docs/read: Mention the more common mode first
Printing to stdout is a thing it can do, yes, but writing to variables
is the more typical way to use it.
2023-10-12 22:35:43 +02:00
Johannes Altmanninger
bba0103103 build.rs: re-run if compat.c changed 2023-10-12 21:55:11 +02:00
David Adam
0f70b2c0d3 README: bump CMake requirements for Rust build
file(real_path) added in 35baa883 requires CMake 3.19.
2023-10-12 15:48:38 +08:00
Fabian Boehm
6be5b02231 Test for mktemp completion
Turns out fish isn't in $PATH on the CI systems

(cherry picked from commit 136dc6ce28)
2023-10-08 22:00:57 +02:00
Fabian Boehm
71ef8d317a fish_config: Fix save with variable with multiple values
Your basic quoting problem, regressed in 3.6.0

(cherry picked from commit 098b7093da)
2023-10-08 21:57:08 +02:00
Fabian Boehm
1b98566f3d docs/set: Correct some errors
(cherry picked from commit ad54f07328)
2023-10-08 21:57:08 +02:00
yanshay
8a8c7abb0f added support for fish_sequence_key_delay_ms to set how long to wait between sequence key presses 2023-10-08 21:56:06 +02:00
ridiculousfish
57335ebb02 Reformat colorutils.js using Prettier 2023-10-08 12:27:39 -07:00
ridiculousfish
98018753e5 Replace references to angular with alpine
Updates our license references.
2023-10-08 12:25:43 -07:00
ridiculousfish
5e06e80136 Remove angular "partials"
These are no longer used as we are fully on Alpine.js
2023-10-08 12:22:56 -07:00
Mahmoud Al-Qudsi
0233c0c437 fix is_windows_subsystem_for_linux(), check for post-fork-safety
This function only ever returns true if target_os=linux, so we need to invert
the OS check.

In the first invocation, this function may allocate heap memory.
Clarify that this is safe.

[ja: I don't have the original commit handy so I made up the log message]
2023-10-08 20:48:24 +02:00
Johannes Altmanninger
0a48f4b55c common: remove deprecated methods 2023-10-08 20:46:53 +02:00
Johannes Altmanninger
b583c51238 Sort clippy lints 2023-10-08 20:46:53 +02:00
Johannes Altmanninger
d15e475440 event: reduce lock scope to allow re-locking in event handler
The following "Port execution" commit will use RefCell for the wait handle
store.  If we hold a borrow while we are running an event (which may run
script code) there will be a borrowing conflict. Avoid this by returning
the borrow earlier.
2023-10-08 20:46:53 +02:00
Johannes Altmanninger
575c271461 job_group: reuse RelaxedAtomicBool 2023-10-08 20:46:53 +02:00
Johannes Altmanninger
d764625069 getcwd: fix bad error message 2023-10-08 20:46:53 +02:00
Johannes Altmanninger
ad75c72621 flog: reuse write_to_fd 2023-10-08 20:46:53 +02:00
Johannes Altmanninger
637926a7fd env: fix porting regression recording inherited vars 2023-10-08 20:46:53 +02:00
Johannes Altmanninger
d8de497ebc Use shorter escape() function 2023-10-08 20:46:53 +02:00
Johannes Altmanninger
0b25793097 wildcard: use "zelf" over "this" for consistency
The following "Port execution" commit will add lots of variables called "zelf".
2023-10-08 20:46:53 +02:00
Johannes Altmanninger
6ef5ae0935 env: skip env lines without equal sign
Given an env like

    foo
    bar=baz

we would set "foo" to empty due to a typo.
The typo is pointed out by a PORTING comment.

Luckily I don't think we ever hit this case because that would mean our
parent process has a serious bug.  Rust's std::env::vars_os() skips env
lines that don't contain a "=" char.  This seems like a reasonable behavior
for us too. Do that.
2023-10-08 20:46:53 +02:00
Johannes Altmanninger
e8712af0c3 builtin random: make option parsing consistent with other builtins again
As suggested in a comment on2fb352a9e (Address some clippy lints from nightly
clippy, 2023-10-03).
2023-10-08 20:46:53 +02:00
Fabian Boehm
724b44907e Reduce stat calls for wildcards ending in "/" (#10032)
This makes it so expand_intermediate_segment knows about the case
where it's last, only followed by a "/".

When it is, it can do without the file_id for finding links (we don't
resolve the files we get here), which allows us to remove a stat()
call.

This speeds up the case of `...*/` by quite a bit.

If that last component was a directory with 1000 subdirectories we
could skip 1000 stat calls!

One slight weirdness: We refuse to add links to directories that we already visited, even if they are the last component and we don't actually follow them. That means we can't do the fast path here either, but we do know if something is a link (if we get d_type), so it still works in common cases.

(cherry picked from commit 86803e4442)
2023-10-08 17:15:20 +02:00
Fabian Boehm
18c65df3c7 Add a clear-screen bind function to clear the screen (#10044)
This can be bound like `bind \cl clear-screen`, and is, by default

In contrast to the current way it doesn't need the external `clear`
command that was always awkward.

Also it will clear the screen and first draw the old prompt to remove
flicker.
Then it will immediately trigger a repaint, so the prompt will be overwritten.

(cherry picked from commit c4ca1a68d3)
2023-10-08 17:15:20 +02:00
Mathijs Henquet
4b12671b1c Fix out of scope opt variable (#10020)
* Fix out of scope opt variable

* Update ls.fish

(cherry picked from commit a809672412)
2023-10-08 17:15:20 +02:00
Fabian Boehm
11304f00cf Apply variable overrides for exec
Fixes #9995

(cherry picked from commit 496d65fb5d)
2023-10-08 17:15:20 +02:00
Fabian Boehm
ac64331217 reader: Only move cursor if needed for repaint-mode
This uses "screen.reset_line" to move the cursor without informing the
reader's machinery (because that deals with positions *in the
commandline*), but then only repainted "if needed" - meaning if the
reader thought anything changed.

That could lead to a situation where the cursor stays at column 0
until you do something, e.g. in

```fish
bind -m insert u undo
```

when you press alt+u - because the *escape* calls repaint-mode, which
puts the cursor in column 0, and then the undo doesn't, which keeps it
there.

Of course this binding should also `repaint-mode`, because it changes
the mode.

Some changes might be ergonomic:

1. Make repaint-mode the default if the mode changed (we would need to
skip it for bracketed-paste)
2. Make triggering the repaint easier - do we need to set
force_exec_prompt_and_repaint to false here as well?

Anyway, this

Fixes #7910

(cherry picked from commit ff433b0cb2)
2023-10-08 17:15:20 +02:00
Fabian Boehm
04492a1a23 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

(cherry picked from commit f8e38819a5)
2023-10-08 17:15:20 +02:00
Xiretza
52276e4766 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.

(cherry picked from commit 0cdf801d0b)
2023-10-08 17:15:20 +02:00
Kevin F. Konrad
bd6471d2ce add completions for crc and oc (#10034)
(cherry picked from commit 269c9c3f0c)
2023-10-08 17:15:20 +02:00
Roland Fredenhagen
542e23e87b completions: add watchexec (#10027)
* completions: add watchexec

* review

(cherry picked from commit e6bef40c22)
2023-10-08 17:15:20 +02:00
Fabian Boehm
577dc2be94 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

(cherry picked from commit 10d91b0249)
2023-10-08 17:15:20 +02:00
Charlotte
3027bc355b completions/pkill: use locals.
(cherry picked from commit 7c5777a82a)
2023-10-08 17:15:20 +02:00
NextAlone
9ea7465ab4 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

(cherry picked from commit 3bcde90a88)
2023-10-08 17:15:20 +02:00
Fabian Boehm
57bd21e7ce __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

(cherry picked from commit b03327f5d2)
2023-10-08 17:15:20 +02:00
Jason Nader
1119f68e66 completions: add ibmcloud (#10004)
* completions: add ibmcloud

* Update ibmcloud.fish

(cherry picked from commit d6e234c60c)
2023-10-08 17:15:20 +02:00