Commit Graph

15920 Commits

Author SHA1 Message Date
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
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
David Adam
62cc498e1c CHANGELOG: remove entries moved to 3.5.1 2022-07-13 23:14:25 +08:00
SeekingBlues
173914af65
Highlight history searches correctly (#9066)
Previously, the search text is used to find out which part of the
updated command line should be highlighted during a history search. This
approach will cause the incorrect part to be highlighted when the line
contains multiple instances of the search text.

To address this, we have to find out exactly where to highlight, i.e.
the offset of the current token in the command line (0 if not a token
search) plus the offset of the search text in the match.
2022-07-13 16:48:04 +02:00
Fabian Boehm
cc632d6ae9 realpath: Use the parser's working dir
Future proofing, similar to what we do in `path resolve`.
2022-07-12 20:53:57 +02:00
Fabian Boehm
526b7e3b1b readdir_for_dirs: Actually filter out non-dirs
This function is supposed to return "the next directory". Because this
is imperfect, it only tries to.

Except it went to all the trouble of figuring out the type and then
just... returned it anyway.

This has nice speedups in globs with directory components like `*/` or
`**`. I have observed 1.1x to 2.0x.

We could also return when we know it's definitely a directory and then
skip a stat() later, but preliminary testing seemed to show that's not
worth much.
2022-07-12 16:50:00 +02:00
Aaron Gyes
dbb4e05254 Revert "PCRE2.cmake: update minimum system PCRE2 version, use GIT_SHALLOW"
This was in response to a feature we were using that required a
very new PCRE2: that was backed out.

So this reverts commit e63af7d006.
2022-07-10 12:44:35 -07:00
ridiculousfish
a9964cd6d0 Remove usage of PCRE2_SUBSTITUTE_LITERAL
We don't need this flag and this ties us to a newer version of PCRE2
than we would like. Fixes #9061.
2022-07-10 11:17:19 -07:00
Aaron Gyes
cbd0ec568c builtins/path.cpp: remove <glob.h>
I don't believe we use any system glob faciltiies.
2022-07-09 21:11:43 -07:00
Aaron Gyes
3e0f3c9f45 path.cpp: include its actual header with the prototype
path.h: fix that header so it can compile.
2022-07-09 21:04:03 -07:00
Aaron Gyes
e63af7d006 PCRE2.cmake: update minimum system PCRE2 version, use GIT_SHALLOW
GIT_SHALLOW 1 here improves generation speed and _deps in the build
dir like is 6 or 7 MB less according to `du`.

Bump the minimum PCRE2 to 10.35 on account of we use
PCRE2_SUBSTITUTE_LITERAL.
2022-07-09 20:00:53 -07:00
David Adam
c3c8cf1e01 fish.spec: depend on system pcre2 libraries on all platforms
These are now available on all supported platforms, and the download
process tends to break on build workers (where Internet access is
deliberately denied).
2022-07-10 10:43:14 +08:00
ridiculousfish
f7c411d5a5 Further cleanup of builtin_string regex matching
Take advantage of additional cleanup unlocked by this refactoring,
including eliminating unneeded error returns and simplifying some
control flow.

No user-visible behavior change expected here.
2022-07-09 16:44:12 -07:00
ridiculousfish
d46f402cea Adopt the new re in builtin_string
This switches builtin_string from using PCRE2 directly, to using the new re
component. This simplifies some code and removes redundancy.

No user-visible behavior change expected here.
2022-07-09 16:41:15 -07:00
ridiculousfish
7ae1727359 Factor out PCRE2 into new re component
This migrates our PCRE2 dependency from builtin/string.cpp to new files
re.h/re.cpp, allowing regexes to be used in other places in fish.

No user-visible behavior change expected here.
2022-07-09 16:37:20 -07:00
Aaron Gyes
a1dd93df41 Update touch completions for all the platforms
- Generally better descriptions,
- uname checks to not complerte unavailable options on
  NetBSD, FreeBSD, DragonFly, Solaris, Darwin
- Describe/complete GNU's --time=access,mtime... arg
- Remove -f it is a no-op and not documented.
2022-07-09 13:42:00 -07:00
Israel Chauca Fuentes
9e43e74723 Add completion for the "expect" command 2022-07-09 13:44:45 +02:00
Alexander M
8d57bc6a9a Fix long descriptions in gdb.fish
Work on #6981
2022-07-09 12:28:22 +02:00
Johannes Altmanninger
1527edd542 Stop printing extra newline when Alt-W or Alt-L is used with a multiline prompt
When we want to print something while the prompt is still active, we move the
cursor by printing a newline for each line in the prompt beyond the first
one. As established by 80fe0a7fc (fish_job_summary: Format message better
for multiline prompts, 2022-06-28), our use of "string repeat" actually
prints an extra newline. Let's remove it here as well.
2022-07-06 16:31:17 +02:00
ridiculousfish
61b09ff4a7 Stop using a static unordered_map for string flag handlers
This switches the flag_to_function from a map to just an ordinary switch
statement. This saves some memory/startup time and removes some
relocations. No functional change here.
2022-07-04 13:40:55 -07:00
Johannes Altmanninger
aec8413f7b CHANGELOG: remove entries which have moved to Integration_3.5.1 2022-07-04 20:17:56 +02:00
Guy Bolton King
1f130fbfe1 Remove invalid trailing period in CSI u shift-space binding 2022-07-04 19:43:03 +02:00
Fabian Boehm
8082f8c056 completions/git: Use __fish_git
That's the one that silences stderr!
2022-07-03 09:42:37 +02:00
ridiculousfish
5c4f88fb16 Merge branch 'pcre-external'
This merge commit incorporates changes to download and build PCRE2 if
not found on the system, removing the vendored sources.

Fixes #8355
2022-07-02 20:18:54 -07:00
ridiculousfish
3c6581bcc7 Relnote removal of vendored PCRE2 sources 2022-07-02 19:00:08 -07:00
ridiculousfish
7f204ed64c Update the README to reflect new PCRE2 instructions 2022-07-02 19:00:08 -07:00
ridiculousfish
6c81eb14d7 CI: ubuntu-32bit-vendored-pcre2 -> ubuntu-32bit-fetched-pcre2
We no longer vendor PCRE2 sources, instead we fetch them from the
official repo.
2022-07-02 19:00:08 -07:00
ridiculousfish
ed37cb6e35 Mac package: pass -f when deleting the temp directory
CMake's FetchContent package will check out a git repo and leave
permissions as read-only, causing rm to fail. Pass -f so that rm will
succeed.
2022-07-02 18:49:54 -07:00
ridiculousfish
780fc4b566 Pass FISH_USE_SYSTEM_PCRE2=OFF in Mac package build
This ensures we don't link against a system installed libpcre2.
Comment in the script why not.
2022-07-02 18:49:44 -07:00
ridiculousfish
9b89f4a9a3 Remove vendored pcre2 directory
Now that PCRE2 is dynamically fetched and built, we can remove the vendored
directory.

Fixes #8355
2022-07-02 18:46:58 -07:00
ridiculousfish
5b1e106d87 cmake: Download and fetch PCRE2 rather than using vendored sources
This switches to using the CMake FetchContent path to dynamically download
and build PCRE2, allowing us to drop the vendored sources.

The FISH_USE_SYSTEM_PCRE2 CMake option is kept, but if false it now means
fetch-and-build PCRE2 rather than building vendored sources.

Note FetchContent was introduced in CMake 3.11. That is now a prerequisite
for building fish with FISH_USE_SYSTEM_PCRE2 disabled.
2022-07-02 18:46:58 -07:00
ridiculousfish
ffded81a00 Correct a misleading comment 2022-07-02 11:30:59 -07:00
Kid
e6505d1c30 file completion nuances on macOS 2022-07-02 11:33:03 +02:00
Fabian Boehm
60f87ef3be Add error for EBADARCH
That's apparently errno 86 on macOS, and it's triggered when the
architecture is wrong.

I'll leave other macOS errors to the macOS users.

See #9052.
2022-07-02 10:11:00 +02:00
Fabian Boehm
d920610f96 Fix special readline functions after and/or
Here we needed to handle self-insert immediately, but we ended up
returning it.

Fixes #9051
2022-07-02 09:23:11 +02:00