Commit Graph

16044 Commits

Author SHA1 Message Date
Fabian Boehm
e3f6b8ba17 completions/git: Reword descriptions
These should be friendlier, but aren't as pedantically accurate.

I think the term "index" is terrible and much prefer "staging area".

Also "rev-parse" simply must be believed to be seen, it can't be
described in a single paragraph. (did you know you can use `git
rev-parse --parseopt` as a replacement for `getopt` in arbitrary
shell scripts?)
2022-08-10 17:52:27 +02:00
Fabian Boehm
754a6da060 CHANGELOG
I really hate doing these as separate commits, but I hate it more when
there's weird merge/revert conflicts when it's in the same commit.
2022-08-10 17:04:23 +02:00
Fabian Boehm
37f7818bbb printf: Ignore any options
This was misguidedly "fixed" in
9e08609f85, which made printf error out
with any "-"-prefixed words as the first argument.

Note: This means currently `printf --help` doesn't print the help.
This also matches `echo`, and we currently don't have anything to make
a literal `--help` execute a builtin help except for keywords. Oh well.

Fixes #9132
2022-08-10 16:55:56 +02:00
Fabian Boehm
c288443b4d CHANGELOG 2022-08-09 20:34:40 +02:00
Fabian Boehm
47ae6bc746 Webconfig: Fix IPv6 availability detection
"socket.has_ipv6" is basically useless - it tells you python has
been *compiled* with ipv6 support.

Instead just try ipv6 and if that fails with EAFNOSUPPORT (checking
the actual errno), try v4.

Yes, I explicitly do not care to test this on python2.

Fixes #3857
2022-08-09 20:33:32 +02:00
Fabian Boehm
fcbd9730de completions/git: Shorten alias descriptions
I have an alias called "lg" for

log --color --graph --pretty=format:\'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\' --abbrev-commit --first-parent

Having that in my completions ensures that git commands essentially
always use one column at most. That's not great, so we now shorten it
to 35 chars (plus an annoying 2 for ".." because I can't be bothered
to check for unicode support - an argument for a "string ellipsize", I guess?)
2022-08-09 20:19:33 +02:00
Fabian Boehm
2eae563b82 CHANGELOG 2022-08-09 20:06:22 +02:00
Fabian Boehm
7d8009e9d6
Disclose pager to half of screen height immediately (#9105)
* Disclose pager to screen height immediately

This removes that bit where we only show 4 rows at most at first,
instead we disclose between half of terminal height up to the full terminal height (but still at least 4 rows).

This results in less pressing of tab to get the other results, and
better visibility of results.

Unlike moving it to the actual top of the screen, it's not as jarring and doesn't push terminal history off-screen as much.

Fixes #2698
2022-08-09 20:05:08 +02:00
Fabian Boehm
d7b82618ec CHANGELOG 2022-08-09 20:01:20 +02:00
Fabian Boehm
b89249de98 Reset the read byte limit to the default when unset
This used to be kept, so e.g. testing it with

    fish_read_limit=5 echo (string repeat -n 10 a)

would cause the prompt and such to error as well.

Also there was no good way to get back to the default value
afterwards.
2022-08-09 19:59:10 +02:00
Fabian Boehm
eac808a819
string repeat: Don't allocate repeated string all at once (#9124)
* string repeat: Don't allocate repeated string all at once

This used to allocate one string and fill it with the necessary
repetitions, which could be a very very large string.

Now, it instead uses one buffer and fills it to a chunk size,
and then writes that.

This fixes:

1. We no longer crash with too large max/count values. Before they
caused a bad_alloc because we tried to fill all RAM.
2. We no longer fill all RAM if given a big-but-not-too-big value. You
could've caused fish to eat *most* of your RAM here.
3. It can start writing almost immediately, instead of waiting
potentially minutes to start.

Performance is about the same to slightly faster overall.
2022-08-09 19:58:56 +02:00
Kevin Konrad
6128b58be6 add completion for kind
Closes #9110
2022-08-09 18:58:22 +02:00
Daanturo
08a48af356 Add Firefox completions 2022-08-09 18:54:49 +02:00
Fabian Boehm
df7b97d99d Link to correct path subcommand
Resolve is indeed the same as resolve
2022-08-08 21:13:10 +02:00
Christopher Phillips
275eb9d218 move new $PATH detection only inside WSL 2022-08-08 20:58:48 +02:00
Christopher Phillips
aba62c2211 add safe $PATH lookup; update powershell regex 2022-08-08 20:58:48 +02:00
Christopher Phillips
6e6085a623 Update -z statement to remove close paren error 2022-08-08 20:58:48 +02:00
Christopher Phillips
d20554e343 Revert -z statement in help.fish
A recent commit added an invalid expression to the help.fish script. The
"-z" flag caused the error: "test: Missing close paren at index 11"
2022-08-08 20:58:48 +02:00
Christopher Phillips
8e3e50f9ee Add powershell support to suppress UNC path error
Prefer using powershell.exe over cmd.exe on wsl to supress terminal error:
"CMD.EXE was started with the above path as the current directory"
2022-08-08 20:58:48 +02:00
database64128
f6e3f4db34 cp completions: reflink's arguments are optional
When no arguments are unspecified, `--reflink` is equivalent to `--reflink=always`.
2022-08-08 10:18:40 +02:00
ridiculousfish
e0a4d49ef3 Bravely stop appending a newline in reader_shell_test
This newline apparently dates back to when we required all statements to
be terminated; but our AST no longer requires that so we can remove
this. No functional change expected here.
2022-08-07 14:03:33 -07:00
ridiculousfish
1dff1cb2c4 Factor out handling of readline_cmd_t::execute
This reduces the size of handle_readline_command.
No functional change.
2022-08-07 13:37:56 -07:00
Johannes Altmanninger
7fb4b7c8bd prompt_pwd: stop clobbering global/universal fish_prompt_pwd_full_dirs
Closes #9123
2022-08-07 20:24:51 +02:00
ridiculousfish
deec78cdd3 cmake: Unset GIT_WORK_TREE and GIT_DIR before FetchContent_Populate
GIT_WORK_TREE is an environment variable which tells git where the
worktree is. It may be set by the user or by git itself, e.g. when
running `git rebase -i --exec ...`. If it is set, it overrides the
working directory, causing the `git checkout` from FetchContent_Populate
to fail. Clear this variable.

Do the same for GIT_DIR for the same reason.

A way to reproduce the failure that this commit fixes is:

    git rebase -i HEAD^^^ --exec 'ninja -C /path/to/build/dir fish'

prior to this commit, using the fetched PCRE2, this would fail in CMake.
2022-08-06 13:07:22 -07:00
Fabian Boehm
39fbc27d8d Clarify math documentation
The words "rounded down" here get us into some trouble.
2022-08-06 10:58:46 +02:00
SeekingBlues
f9786673e3 Fix typo for or input function 2022-08-05 18:32:32 +02:00
Fabian Boehm
0f3e58efe7 Update littlecheck to e2f243e80117aad27adfb8da73f4901c88b3af6d
Now prints a message if process was killed by a signal, truncates
output if no more checks were found, has an option to force color.
2022-08-05 18:29:29 +02:00
Michael Nickerson
b08a962edb Fix compile error on OpenBSD 2022-08-04 08:13:19 +02:00
Aaron Gyes
d1f08d4944 Revert "vagrant completions: use __fish_parent_directories"
This reverts commit 7c1b68516d.
2022-08-03 00:34:32 -07:00
Aaron Gyes
7c1b68516d vagrant completions: use __fish_parent_directories 2022-08-02 22:31:23 -07:00
Fabian Boehm
177cfbc605 docs/path: Add some more on resolve/normalize dichotomy 2022-08-02 19:58:43 +02:00
Aaron Gyes
e45b3abab2 test -z 2022-08-02 00:54:38 -07:00
Aaron Gyes
ff2999ef2b Three more of the same test -z thing. 2022-08-02 00:42:37 -07:00
Aaron Gyes
b9590d04e7 fish_toggle_commandline: minor test cleanup 2022-08-02 00:30:06 -07:00
Aaron Gyes
df51fea897 git completion: use new test -ef
Just an opportunistic little cleanup. Technically faster.
2022-08-02 00:15:50 -07:00
Johannes Altmanninger
095c093af6 Fix "commandline --paging-mode" false negative when there is no room for pager, attempt 2
The previous fix was reverted because it broke another scenario.  Add tests
for both scenarios.

The first test exposes another problem: autosuggestions are sometimes not
recomputed after selecting the first completion with Tab Tab. Fix that too.
2022-07-31 07:14:56 +02:00
Aaron Gyes
7b18a70724 Revert "Fix "commandline --paging-mode" false negative when there is no room for pager"
This reverts commit 1edcd8ab29.

The commit broke hitting <TAB> to show the pager, followed by
down-or-search.
2022-07-30 18:15:10 -07:00
Johannes Altmanninger
88d1317eaa completions/git: forward a ./-prefix from the command line
"git add ./" shows only hidden files (if at all). It should show all files
that can be added.
The problem is that candidates come from "git status" which prints clean
relative paths. Let's allow some unclean paths.

This is far from a complete fix but it should work for the common scenario.

Observe that wildcard_complete_internal() actually filters out all non-hidden
files, if the query is `./`.

Closes #9091
2022-07-31 00:14:51 +02:00
Johannes Altmanninger
a447cc38a9 Hint at more matches at the bottom of the history pager 2022-07-30 23:27:24 +02:00
Johannes Altmanninger
1af9b8e430 Prefix history pager results with a fake prompt
This makes it easy to see where the individual commands start.  Perhaps we
can get rid of this once we have syntax highlighting for the commands in
the history pager, or if we add timestamps as descriptions.
2022-07-30 23:27:24 +02:00
Johannes Altmanninger
453aac14af Advance pager history search with Control-R/Control-S
Note that every change to the search field still starts a new search, from
the end of history. We could change this in future but it's unclear to me
what the expected behavior is. I don't find the traditional readline behavior
very intuitive.
2022-07-30 23:27:24 +02:00
Johannes Altmanninger
24e04daa22 Teach history search to move forward in time
Will use this for forward incremental search.

No functional change.
2022-07-30 23:27:24 +02:00
Johannes Altmanninger
dcff0a2f2b Add Control+R incremental history search in pager
This reimplements ridiculousfish/control_r which is a more future-proof
approach than #6686.
Pressing Control+R shows history in our pager and allows to search filter
commands with the pager search field.

On the surface, this works just like in other shells; though there are
some differences.

- Our pager shows multiple results at a time.
- Other shells allow to use up arrow/down arrow to select adjacent entries
  in history. Shouldn't be hard to implement but the hidden state might
  confuse users and it doesn't play well with up-or-search, so this is
  left out.

Users might expect the history pager to use subsequence matching (fuzzy
matching) like the completion pager, however due to the history pager design it
uses substring matching.  We could change this in future, however that means
we would also want to change the ordering from "reverse-chronological" to
"longest common subsequence" (e.g. what fuzzy finders do), because otherwise
a query "fis" might give this ordering:

            fsck /dev/disk/by-partlabel/Linux\x20filesystem
            fish

which is probably not what the user wants.

The pager shows only a small number of history items at a time.  This is
because, as explained above, the history pager does not support subsequence
matching, so navigating it does not scale well.

Closes #602
2022-07-30 23:27:24 +02:00
Johannes Altmanninger
b0233c9aa7 Revert "Refactor: inline clear_pager()"
The next patch wants to add state that should be reset when we clear the
pager, which will happen in this function.

This reverts commit b25b291d38.

No functional change.
2022-07-30 23:27:24 +02:00
Johannes Altmanninger
9a0d8e67df Extract function for smartcase history search
To be used in the commit after next.

No functional change.
2022-07-30 23:27:24 +02:00
Johannes Altmanninger
3954200555 Centralize how we invalidate pager rendering after completions change
The pager's rendering_needs_update() function detects some but not all
scenarios where a rendering is stale. In particular, it does not compare
the completion strings.

To make this work, we manually invalidate the pager rendering whenever we
update completion strings. The history pager needs the same functionality,
so let's move it into the pager.

No functional change.
2022-07-30 23:27:24 +02:00
ridiculousfish
2410e27d10 Add a test and CHANGELOG fix for #9096 2022-07-30 10:14:19 -07:00
Baspar
ec8fd628bd Generate job & process exit events for background jobs 2022-07-30 10:06:33 -07:00
Michael Forster
91c68ec1af Add fish_cursor_selection_mode documentation 2022-07-30 09:49:23 -07:00
Michael Forster
6003edfb42 Add test for the default cursor selection mode
Also add documentation for the tests
2022-07-30 09:49:07 -07:00