Commit Graph

15654 Commits

Author SHA1 Message Date
Fabian Homborg
49d75ff689 completions/git: Print all known files for git log 2022-05-26 14:17:15 +02:00
Fabian Homborg
65b9c26fb4 complete: Print better error for -x -F
-x is a cheesy shortcut for `-rf`, so it conflicts with `-F`.

Fixes #8818.
2022-05-26 14:17:15 +02:00
Johannes Altmanninger
be781e9144 edit_command_buffer: ignore user remappings for vim
edit_command_buffer uses the "norm" command for moving the cursor to a column
with the "|" primitive.  The problem is that the user can remap "|".  Fix this
by using the "norm!" variant which ignores user mappings (see ":h norm").

Closes #8971
2022-05-26 13:15:15 +02:00
Fabian Homborg
15f1b5f368 Skip building version file if git describe fails the new perm check
git had a CVE related to arbitrary code being run when you run git status and similar, and instead of doing something about those arbitrary code bits they decided to lock it down entirely.

So now git will refuse to do basically anything once it detects the .git directory is owned by someone else.

So, what we do is:

If `git describe` failed with a status of 128, we keep an already
built version file.

This is an awful hack, but should help with the normal `cmake; make; sudo
make install` cycle.

(the only *real* way around this seems to be to not attempt to rebuild
the version file at install time entirely, but I have no idea how to
do that)

Fixes #8973.
2022-05-26 09:35:59 +02:00
ridiculousfish
ec6fd088f2 Migrate initializing CMD_DURATION from reader to env
This puts the initialization of CMD_DURATION at home with other
default-initialized variables. No user-visible change expected from
this.
2022-05-22 12:29:51 -07:00
ridiculousfish
4d3261dadc Bravely stop initializing the term size from reader_init
The terminal size in all cases should have been initialized in env_init,
so no reason to do it here. No user visible change expected from this.
2022-05-22 12:28:05 -07:00
mhmdanas
b3de630d40 Add signoff options to git commit completions
Fixes https://github.com/fish-shell/fish-shell/issues/8965.
2022-05-21 20:27:32 +02:00
Fabian Homborg
86ab81dadf Remove searchtools.js
With sphinx 4.5.0:

1. Some of our builtins actually give results (cd, end, set)
2. Some give broken results (and, if, or)
3. Only "for" even triggers the help page we hacked in

So this is of dubious use, and removing it gets us out of the awkward situation of shipping it.

Plus upstream sphinx has ditched jquery, so we would have to rewrite it anyway.
2022-05-19 17:38:41 +02:00
Fabian Homborg
b5a8d6b505 CHANGELOG eval 2022-05-18 18:51:48 +02:00
Fabian Homborg
8f9348ee53 Make eval a reserved keyword
Like `set` and `read` before it, `eval` can be used to set variables,
and so it can't be shadowed by a function without loss of
functionality.

So this forbids it.

Incidentally, this means we will no longer try to autoload an
`eval.fish` file that's left over from an old version, which would
have helped with #8963.
2022-05-18 18:47:10 +02:00
Fabian Homborg
b548e1d8fe Fix tests
Oops, unclean extraction from larger work.
2022-05-17 17:21:42 +02:00
Fabian Homborg
b71416f610 fish_add_path: Also deduplicate the new paths
Previously, running `fish_add_path /foo /foo` would result in /foo
being added to $PATH twice.

Now we check that it hasn't already been given, so we skip the
second (and any further) occurence.
2022-05-17 17:05:56 +02:00
Michael Jarvis
54356da24f Fix sphinx-doc warning
[ 97%] Building man pages with Sphinx
../CHANGELOG.rst:123: WARNING: Bullet list ends without a blank line; unexpected unindent.
[ 97%] Built target sphinx-manpages
[ 98%] Building HTML documentation with Sphinx
../CHANGELOG.rst:123: WARNING: Bullet list ends without a blank line; unexpected unindent.
2022-05-16 16:25:15 -07:00
ridiculousfish
ba7c84fe3b Add an error message when cd fails with ELOOP
This error is emitted if you try to `cd` into a symlink loop or very
long chain.
2022-05-15 11:58:40 -07:00
Mahmoud Al-Qudsi
706f56867c Consider xdg-open to be a graphical browser
Otherwise, if xdg-open redirects `help` to Firefox, the terminal will be
spammed with debug messages.
2022-05-15 13:53:47 -05:00
ridiculousfish
0b3e70a506 Relnote new apk completions from #8951 2022-05-14 10:45:05 -07:00
Jacob Panek
8c44eb5dd3 fix completion, apk {add,manifest} accept files 2022-05-14 10:41:45 -07:00
ridiculousfish
1893204067 event_fire_generic to take its arguments directly
Just mild refactoring, no functional change.
2022-05-14 10:33:47 -07:00
ridiculousfish
b0084c3fc4 Refactor event handler firing
This concerns what happens if one event handler removes another, when
both are responding to the same event. Previously we had a "double lock"
where we would traverse the list twice. Now track directly in the
handler when it is removed; this simplifies the code a lot. No
functional changes expected here.
2022-05-14 10:33:47 -07:00
ridiculousfish
31567cea63 Mild refactoring of how received signals are stored
No functional change here, just some cleanup.
2022-05-14 10:33:47 -07:00
NextAlone
ce2064d8b6 fix: completion git mv with ls-files 2022-05-14 17:55:39 +02:00
NextAlone
0f18a4f92b fix: git ls-files --stage 2022-05-14 17:11:07 +02:00
Johannes Altmanninger
bfd5e8dfbe Do not stomp token if tab-expansion of wildcards exceeds limit or is canceled
Hitting tab on "echo **" will often result in more than 256 matches.
Commit 143757e8c (Expand wildcards on tab, 2021-11-27) describes this scenario

> If the expansion would produce more than 256 items, we flash the command
> line and do nothing, since it would make the commandline overfull.

Yet we actually erase the "**" token, which seems wrong since we already
flash the command line. Fix this, at the cost of making the code a bit uglier.

I tried to write a test in tests/pexpects/wildcard_tab.py but that doesn't
seem to work because pexpect provides only a "dumb" terminal.  I wonder if we
can test what we write to the screen without depending on a terminal emulator.
2022-05-14 14:31:30 +02:00
Fabian Homborg
8bfc987705 docs/math: Some simple changes 2022-05-14 10:59:41 +02:00
Henrik Hørlück Berg
c5a6dce27a Docs: be more consistent about argument formatting 2022-05-14 10:05:02 +02:00
Henrik Hørlück Berg
255bfffed7 Fix more lost string documentation
- Errors from 14d60ccb32
- See: #8928
2022-05-14 10:05:02 +02:00
Dmitry Gerasimov
39df8f0b3f Add missing cp completions
All of the missing options were present in the GNU cp for more than 8
years, so it makes sense to add completions for them.
2022-05-13 20:55:36 +02:00
Dmitry Gerasimov
bb108435bb Fix wg-quick completion running from root
`wg show` command shows entire interfaces configuration, not just the
list. This breaks completion when running fish from root, because
command output looks like this:

    interface: wg0
      public key: fred2rX85AxpcTObLuiWTzkRPZaXjnhd1C4XOdZOGWs=
      private key: (hidden)
      listening port: 12345
      fwmark: 0xca6c

    peer: g2YHHDkxmgoT9EV0TxKtq556WLXpaOh4zgC5L7EAGTQ=
      endpoint: 192.168.88.50:54321
      allowed ips: 0.0.0.0/0, ::/0
      latest handshake: 1 minute, 37 seconds ago
      transfer: 1.83 MiB received, 927.19 KiB sent

To show just the list of active interfaces, `wg show interfaces` should
be used instead.
2022-05-13 20:55:24 +02:00
Johannes Altmanninger
8df5547f2d __fish_man_page: don't try tokens with slashes as subcommands
man-db's man 2.7 as shipped in OpenSUSE fails to set a non-zero
exit code when invoked like "man ls-some/dir". This means
that we fail to display the man page if the commandline is
"ls some/dir". Work around this by never treating tokens
with slashes as subcommand.
2022-05-13 20:46:01 +02:00
Johannes Altmanninger
bb325e497a __fish_man_page: simplify
This helps the next commit. No functional change.
2022-05-13 20:46:01 +02:00
Mahmoud Al-Qudsi
72ae46e922 CHANGELOG: include alt-s doas support
See #8942
2022-05-12 14:09:18 -05:00
Jacob Panek
a57b09623e prepend doas; instead of sudo; if exists 2022-05-12 14:03:27 -05:00
Dmitry Gerasimov
4e19bfb5ed Add --no-patch option to git show completion 2022-05-12 20:31:44 +02:00
NextAlone
bd1e07de23 fix: complete git rebase with commits first and keep-order
Because TAGs are easy to type and complete, but commits with its SHA are
difficult to complete manualy. Keep commits and TAGs order to show more recent
commits first.
2022-05-12 20:30:33 +02:00
Gregory Anders
55f0f2de4c Search $__fish_user_data_dir for vendor additions 2022-05-12 20:29:05 +02:00
Laura Hild
f0deafdfe7 Make __fish_print_rpm_packages work on macOS 2022-05-12 20:28:25 +02:00
Johannes Altmanninger
a8b3922a74 Work around to prevent premature Ctrl-D from inserting spaces
Pressing Ctrl-D while a command is running results in a null key code in
our input queue. That key code is bound to insert a space (without expanding
abbreviations). Make it only insert a space if the commandline is non-empty,
to accommodate this use case.

This probably affects other keys as well.

Closes #8871
2022-05-11 22:06:25 +02:00
Fabian Homborg
32aef855b7 Initialize variable
gcc 12.1 complains this might be used uninitialized.
2022-05-11 21:28:26 +02:00
ridiculousfish
11cfa85a2a Correctly fire process_exit events even if the job has not yet exited
c4fb857dac (in 3.4.1) introduced a regression where process_exit
events would only fire once the job itself is complete. Allow
process_exit events to fire before that. Fixes #8914.
2022-05-08 15:27:25 -07:00
ridiculousfish
9efde28350 Revert "Optimize exit event generation"
This reverts commit 1b6ef6670f.

This optimimzation did not carry its weight in complexity.
2022-05-08 15:08:28 -07:00
ridiculousfish
1f7d4c7441 Fix CPU usage percentage calculation as reported by jobs
This rationalizes our types for computing CPU usage percentage and
fixes the computation. Fixes #8919.
2022-05-07 15:29:56 -07:00
Fabian Homborg
770a2582de Give special error for when file failed to execute but is executable
This is after we've tried to find the interpreter, so we would already
have complained about e.g. /usr/bin/pthyon not existing.

Realistically the most common case here is things that don't start
with a shebang like ELFs. Writing special extraction code here is
overkill, and I can't see a good function to do it for us.

But this should point you in the right direction.

Fixes #8938
2022-05-07 14:53:03 +02:00
Fabian Homborg
e3c6cbaaa6 Fix typo 2022-05-07 14:47:08 +02:00
Henrik Hørlück Berg
837c446dc6 Document string split --fields
- The parameter-listing appears to have been lost as a part of
  14d60ccb32
2022-05-02 17:46:18 +02:00
Fabian Boehm
dd95e0a0ea
Setup $USER if passwd for $USER has different uid (#8879)
This gets the passwd entry for $USER (if it is set). If that gives the
same uid that geteuid() gives us, we assume the data is correct.

If not, we reset $USER (and $HOME if it's empty) from the passwd value for our UID.

This allows using $USER in a prompt even if you've `su`d. Bash gets around this by having a special escape in its $PS1 DSL that checks passwd instead.

Fixes #8583
2022-05-02 17:15:52 +02:00
merelymyself
ed8148233e completions/git: add options for grep, init, prune, revert, rm, status
Closes #8906
2022-05-01 17:08:00 +02:00
mhmdanas
838fd5f85e Add --unset-upstream to git branch completions 2022-05-01 17:07:36 +02:00
Johannes Altmanninger
ad9b4290e5 completions/git: cache subcommand computation
Whenever completing any git commandline, we invoke __fish_git_using_command
173 times*. Every invocation calls "commandline" and "argparse"
to the same effect. Let's parse the command line once, and reuse the results
later.

I'm observing a speed-up from 200ms to 120ms with

    perf stat -r 10 buildrel/fish -c 'complete -C "git checkout ">/dev/null'

Alternative solutions:
1. teach fish to cache such things automatically.
2. rewrite git completions to compute most completions in a single function,
   which will naturally avoid redundant work. This sounds viable but it's
   a lot of work.

* we have a thousand uses of __fish_git_using_command, so I'm not sure why
it's only 173.

See the discussion in #8266
2022-05-01 16:37:55 +02:00
Johannes Altmanninger
ca98325462 CHANGELOG: fix typo 2022-05-01 16:37:55 +02:00
Emirhan Karagül
908da627b8 Fix style of eq operator 2022-04-28 17:37:47 +02:00