Commit Graph

16123 Commits

Author SHA1 Message Date
Johannes Altmanninger
bd5610349d Fix pager backwards movement on half-filled last column
If the completion pager renders as

	foo1 bar1 baz1 qux1
	foo2 bar2 baz2
	foo3 bar3 baz3

and we go backwards from "foo1" (using left arrow), we'll end up at "baz3",
not "qux1". Pretty smart!

If however we go backwards once more, nothing happens.

The root cause is that there are two different kinds of selection indices:
the one before rendering (9/qux1) and the one after we cleverly subtract
the half-filled last column (8/baz3). The backwards movement ends up
decrementing the first, so it moves from 9 to 8 and nothing changes in
the rendering.

Fix this by using the selection index that we actually rendered.

There is another caller that relies on the old behavior of using the unrendered
selection index. Make it use a dedicated overload that does not depend on
the rendering.
2022-07-24 17:12:28 +02:00
Johannes Altmanninger
12d4b50d5f Remove unused parameter from set_fully_disclosed() 2022-07-24 17:11:48 +02:00
Johannes Altmanninger
368b68ff47 Minor simplification of term_donate/term_steal
No functional change.
2022-07-24 17:11:48 +02:00
Fabian Boehm
e04785604a Make static_assert C++11 compatible
static_assert without a message is C++17. Which we can't use 5 years later.
2022-07-24 16:53:53 +02:00
Fabian Boehm
bcd84c6908 Check for waitstatus orientation via cmake
Yeah we need the long way around because old glibc versions have weird WEXITSTATUS.
2022-07-24 16:40:33 +02:00
Fabian Boehm
122b6c1734 status: Only realpath if we got an absolute path
Otherwise realpath would add the cwd, which would be broken if fish
ever cd'd.

We could add the original cwd, but even that isn't enough, because we
need *the parent's* idea of cwd and $PATH.

Or, alternatively, what we need is for the OS to give us the actual
path to ourselves.
2022-07-24 14:31:15 +02:00
Fabian Boehm
d241f0853e status: Do add the command name to the error 2022-07-24 13:17:06 +02:00
Fabian Boehm
4f1c62ff43 status: Realpath the executable path
get_executable_path says: "This needs to be realpath'd"

So how about we do that? The only other place we use it is fish.cpp,
and we realpath it there already.

See #9085
2022-07-24 12:36:32 +02:00
Fabian Boehm
2cb0cada86 Remove sys/mount.h include
This seems to be unnecessary?
2022-07-24 12:24:42 +02:00
Johannes Altmanninger
8b378e9a44 Make complete-or-search select the first candidate
Our pager computes the selected completion based on its rendering. The number
of rows affect the selection, in particular when moving left from the top
left cell.  This computation breaks if the number of rows is zero, which
happens in at least
two scenarios:
1. If the completion pager was not shown (as is the case for complete-or-search)
2. If the search field had filtered away every candidate but not anymore.
I believe in these scenarios the selected completion index is always 0,
so let's fix the selection for that case.

Probably too minor for a changelog entry.

Closes #9080
2022-07-24 10:23:13 +02:00
Johannes Altmanninger
65a9983954 completions/tox: --no-provision takes an optional arg 2022-07-24 10:23:13 +02:00
Fabian Boehm
e6f4c9e162 completions/service: Fix output on OpenRC systems
This used `type -f`, which prints, and only silenced stderr.

Detected by running the check-completions test on Alpine.

It appears nobody does that.
2022-07-24 09:51:15 +02:00
Samuel Venable
e4c7211cd6
Fix NetBSD executable path to not use procfs (#9085)
* Fix NetBSD executable path to not use procfs

* Update common.cpp
2022-07-24 09:26:33 +02:00
Andy Freeland
0f13337ae6
Add autocomplete for tox (#9078)
* Add autocomplete for `tox`

Based on `tox --help` output for tox 3.25.1.

* PR feedback
2022-07-23 23:18:53 +02:00
Fabian Boehm
a98301b021 Allow for EWOULDBLOCK instead of EAGAIN
Posix allows this as an alternative with the same semantics for read.

Found in conjunction with #9067.

Should be no functional difference on other systems.
2022-07-23 23:16:44 +02:00
Fabian Boehm
df5489e0a4 Allow for systems where wait status is signal/return
The wait status value, which we also use internally, is read by a
bunch of macros.

Unfortunately because we want to *create* such a value, and some
systems lack the "W_EXITCODE" macro to do that, we need to figure out
how it's encoded.

So we simply check a specific value, and assume the encoding from
that.

On Haiku the return status is in the lower byte, on other systems it's
typically the upper byte.

TODO: Test on musl (that's the other system without W_EXITCODE).

Fixes #9067
2022-07-23 23:16:44 +02:00
Andy Freeland
dd815eef38
Add completions for dive (#9082)
https://github.com/wagoodman/dive
2022-07-23 22:32:35 +02:00
Fabian Boehm
64adfdee40 Remove wrong UNUSED annotation
This does in fact use streams
2022-07-23 18:02:46 +02:00
Fabian Boehm
a7af4a0307 Replace some uses of tr 2022-07-22 12:21:03 +02:00
Fabian Boehm
a6820cbe62 trap: Remove superfluous helper functions and stringify 2022-07-22 12:21:03 +02:00
David Adam
4bad88f0df update Vi key binding documentation to reflect reality
PR #6777 changed all the keys to uppercase, but many Vi commands are case
sensitive.

PR #7908 changed the "u" binding but the documentation still had the old
meaning.
2022-07-21 22:57:37 +08:00
Fabian Boehm
afe7e2d27f completions/rc-status: Fix missing "-d" 2022-07-20 21:28:57 +02:00
David Adam
e93e85f3ce Merge branch 'Integration_3.5.1' 2022-07-20 22:25:41 +08:00
David Adam
62063e24ca Release 3.5.1 2022-07-20 18:15:43 +08:00
Fabian Boehm
1f0902a5f5 default prompt: Use same status color as default theme
This was weird, because it changed around just because you picked a
separate theme (that didn't have a status color).

Simply use the same color here.
2022-07-19 17:05:48 +02:00
Fabian Boehm
2dc1150e35 themes: Add missing colors from the default theme
These are used in prompts only, and it feels weird not to have them.

In practice, fish_color_host_remote would not be used at all (just
because you switched from the default theme!), while fish_color_status
would fall back on a different value.

That'll be adjusted in the next commit.
2022-07-19 17:03:00 +02:00
Fabian Boehm
ebd6b2cbd7 Sync default themes again
This takes the values from the .theme file.

In future we might think about re-using that, but for now it's too new
and seems brittle to depend on it.
2022-07-19 16:56:16 +02:00
Fabian Boehm
547a4b2baf docs: Link some more to $PATH 2022-07-18 20:53:37 +02:00
Fabian Boehm
603a8e31e3 docs: Link fish_greeting function from FAQ
And explain the variable more in fish_greeting.

Closes #9056
2022-07-18 20:52:16 +02:00
Fabian Boehm
0709b796bb CHANGELOG path mtime 2022-07-18 20:47:39 +02:00
Fabian Boehm
407a455cfd realpath: Use physical PWD
This was an inadvertent change from
cc632d6ae9.

Because we used wgetcwd directly before, we always got the "physical"
resolved $PWD.

There's an argument to be made to use the logical $PWD here as well
but I prefer not to make changes lik that in a random commit without
good reason.
2022-07-18 20:45:30 +02:00
Fabian Boehm
5dfb64b547
Add path mtime (#9057)
This can be used to print the modification time, like `stat` with some
options.

The reason is that `stat` has caused us a number of portability
headaches:

1. It's not available everywhere by default
2. The versions are quite different

For instance, with GNU stat it's `stat -c '%Y'`, with macOS it's `stat
-f %m`.

So now checking a cache file can be done just with builtins.
2022-07-18 20:39:01 +02:00
Wilke Schwiedop
d9ee5d3863 fix trailing comments in __fish_print_hostnames
/etc/hosts specifies, that everything after a #-character is to be
treated as a comment. The current __fish_print_hostnames however only
considers #-characters at the beginning of a line.
Thus the comment from following valid hosts-entry would end up in the
completion output:

1.2.3.4  myhost # examplecomment

getent hosts properly handles comments.
2022-07-17 17:39:58 -05:00
Aaron Gyes
e2fda67439 Adjust fish_color_search_match
Make the default more likely to be perceptible.
2022-07-17 15:20:41 -07:00
Aaron Gyes
763240f1af Just remove the dumb comment. 2022-07-17 14:41:35 -07:00
Aaron Gyes
c312d2281b
fixup 2022-07-17 14:38:35 -07:00
Aaron Gyes
198ce73db5
Update CHANGELOG for test extensions 2022-07-17 14:18:18 -07:00
ridiculousfish
fa3ca60111 Add a tmux-sleep to tmux-history-search
This test was failing often on my local Mac; this sleep seems to make it
reliable again.
2022-07-16 17:46:12 -07:00
Aaron Gyes
77f6afa501 Add testcases for [ extensions
Some sanity checks for -ot, -nt, -ef

Try negative mtime values too, there was interesting behavior
there during development.
2022-07-16 12:40:36 -07:00
Aaron Gyes
92eb6024ed Document the three new [ operators
Explain test(1)'s -ef, -nt, -ot features.
2022-07-16 12:40:36 -07:00
Aaron Gyes
a6ed9ace6a Add -ot, -nt, -ef to test completions
also complete filenames in binary cases

e.g. test path -ef path
2022-07-16 12:40:36 -07:00
Aaron Gyes
8f91ee7f6b builtin test: Implement -ot, -nt, -ef
These are non-POSIX extensions other test(1) utilities implement,
which compares the modification time of two files as proposed for
fish in #3589: testing if one file is newer than another file.

-ef is a common extension to test(1) which checks if two paths refer
to the same file, by comparing the dev and inode numbers.
2022-07-16 12:40:36 -07:00
Johannes Altmanninger
7bdc712615 Clean up weird edge-case for escaping unescaped brackets
As explained by the comment, this was dead code.  If it were ever executed,
it would cause very weird behavior because it would make some completions
randomly affect others.

Let's just print a warning (maybe this is better than crashing?).
2022-07-16 16:42:34 +02:00
Johannes Altmanninger
12cf31de96 Remove a redundant comment
Also add an issue reference since the commit message doesn't have one.
Of course a test would be even better.
2022-07-16 16:42:19 +02:00
Moheeb Aljaroudi
d4d0ac95b0 Fixed problem where fish would escape '~' when completing an unescaped
']'
2022-07-16 16:17:51 +02:00
David Adam
0f84b9fafb CHANGELOG: work on 3.5.1 2022-07-16 21:55:28 +08:00
Bagohart
e7e4d8415b added tab completions for choose
(cherry picked from commit ce6b122f7f)
2022-07-16 21:41:37 +08:00
Bagohart
9cdaf1ec72 added tab completions for navi
(cherry picked from commit 824ee5d70b)
2022-07-16 21:40:30 +08:00
Bagohart
ce6b122f7f added tab completions for choose 2022-07-16 21:40:02 +08:00
Bagohart
824ee5d70b added tab completions for navi 2022-07-16 21:36:12 +08:00