Commit Graph

13605 Commits

Author SHA1 Message Date
Fabian Homborg
4c09012b0d tests: Don't rely on $HOME existing
Apparently the launchpad tests run with $HOME set to a nonexistent
directory. Since we just want *out*, let's just store the previous dir
and go back.
2020-12-29 12:48:11 +01:00
ridiculousfish
43505f7077 Allow ** glob segments to match zero directories
Prior to this change, a glob like `**/file.txt` would only match
`file.txt` in subdirectories; the `**` must match at least one directory.
This is historical behavior.

With this change we move a little closer to bash's implementation by
allowing a literal `**` segment to match in the current directory. That
is, `**/foo` will match both `foo` and `bar/foo`, while `b**/foo` will
only match `bar/foo`.

Fixes #7222.
2020-12-28 23:51:18 -08:00
ridiculousfish
6c08141682 Add a littlcheck glob test
We have some glob tests in fish_tests.cpp, but they are hard to follow.
Begin migrating them
2020-12-28 23:51:18 -08:00
ridiculousfish
df73964ced Clean up some comments around wildcard expansion 2020-12-28 23:51:18 -08:00
Fabian Homborg
3c2cf6241b Add some error tests for cd
Makes work on #7577 easier.
2020-12-28 23:23:06 +01:00
elpres
aaeb7d107c Fixed sentence in fish_hg_prompt docs 2020-12-28 19:39:27 +01:00
Matthew Dutson
0136db0a22 Revise through "Input/Output Redirection" section 2020-12-27 17:49:52 -07:00
Matthew Dutson
bc91a13ba3 Revise through "Quotes" section 2020-12-27 17:57:09 +01:00
Ilan Cosman
94d18c1ac5 CHANGELOG: Add missing --query 2020-12-26 23:18:14 +01:00
Matthew Dutson
f3fee832d4 Revise through "Quotes" section 2020-12-26 14:45:48 -07:00
ridiculousfish
315f8f8a83 Relnote ldapsearch completions
[ci skip]
2020-12-26 12:16:46 -08:00
Nunzarius
d3de09da83 Added completions for ldapsearch 2020-12-26 12:13:44 -08:00
Fabian Homborg
17ceb71169 Increase issue lock time to half a year
Sometimes three months is quite soon, let's see how half a year works out.
2020-12-26 19:36:55 +01:00
Fabian Homborg
a6674483c1 CHANGELOG: Add more issues to 3.2
Importantly I had added some of the `math` things to 3.1 by accident,
this movs them to 3.2
2020-12-26 19:36:24 +01:00
Johannes Altmanninger
d6dd532d6a Do support the new realpath -s in our wrapper function
See #7574
2020-12-26 08:56:34 +01:00
Fabian Homborg
39e1494c56 docs: A bit more on variables 2020-12-24 10:30:59 +01:00
Johannes Altmanninger
322ceb7ab4 builtin realpath: use absolute path also with -s/--no-symlinks
The old test needs to be changed because $XDG_DATA_HOME can be relative.

Fixes #7574
2020-12-24 08:53:08 +01:00
Johannes Altmanninger
4dae106911 Use complete --keep-order with __fish_complete_suffix to prioritize files with matching suffixes
Part of #7040
2020-12-23 19:14:10 +01:00
Johannes Altmanninger
bae75c96d9 __fish_complete_suffix: complete all files, but sort files with matching suffix first
See #7040 and others.
2020-12-23 19:14:10 +01:00
Johannes Altmanninger
d18e1c7bca Revert "completions/unzip: Stop filtering suffixes"
This reverts commit 46068cd257.
2020-12-23 19:14:10 +01:00
ridiculousfish
e43913a547 Stop expanding globs in command position when performing error checking
Before running a command, or before importing a command from bash history,
we perform error checking. As part of error checking we expand commands
including variables and globs. If the glob is very large, like `/**`, then
we could hang expanding it.

One fix would be to limit the amount of expansion from the glob, but
instead let's just not expand command globs when performing error checking.

Fixes #7407
2020-12-22 12:38:51 -08:00
ridiculousfish
a8080e8e6f Allow specifying a limit on number of expansion in operation_context
If the user types something like `/**`, prior to this change we would
attempt to expand it in the background for both highlighting and
autosuggestions. This could thrash your disk and also consume a lot of
memory.

Add a a field to operation_context_t to allow specifying a limit, and add
a "default background" limit of 512 items.
2020-12-22 12:38:51 -08:00
ridiculousfish
0f2d73e4a3 Remove a stale comment 2020-12-22 12:38:51 -08:00
ridiculousfish
c2c729352e Eagerly abort wildcard completions for ** wildcards
Historically fish has not supported tab completing or autosuggesting
wildcards with **. Prior to this fix, we would test every file match,
discover the ** wildcard, and then ignore it. Instead look for **
wildcards at the top level.

This prevents autosuggesting with /** from chewing up your disk.
2020-12-22 12:38:51 -08:00
ridiculousfish
10362a70df Clean up parse_error_offset_source_start
Use range-based for loops and relax the requirement that we have an
error list.
2020-12-22 12:38:51 -08:00
Fabian Homborg
04d7d89020 __fish_print_packages: Extract the rest
Of note: The rpm/yum thing seems to be coupled, so I put it into one
function that tries the yum helper and uses the rpm path otherwise.
Zypper is already its own thing, so this should only be used for yum
and probably dnf (does that still have the helper?)

Zypper can be dropped, as that already used a separate function in the file.

Apk can just be inlined - it's literally one line for installed and another for all packages.
2020-12-22 17:10:02 +01:00
Fabian Homborg
cf59c3b680 completions/eopkg: Rework some comments 2020-12-22 17:10:02 +01:00
Fabian Homborg
97838657b9 Extract creating $XDG_CACHE_HOME into its own function 2020-12-22 17:10:02 +01:00
Fabian Homborg
24012b1941 __fish_print_packages: Break apart
This function doesn't make any sense.

Most things that expect package names expect package names for *one
specific package manager*.

It only happens to work, most of the time, because most people only
have one package manager installed.
2020-12-22 17:10:02 +01:00
Nunzarius
f7966b3249 Added completions 2020-12-22 17:06:27 +01:00
Ivan Tham
c5343a538f Add cargo abbr completions 2020-12-21 23:05:31 +01:00
ridiculousfish
38a30d1798 Mark subclasses of io_data_t as final 2020-12-19 20:06:36 -08:00
ridiculousfish
c1cfefa057 Attempt to fix the ubuntu 32 bit vendored PCRE build
Use 'apt update' and see what happens
2020-12-19 18:22:10 -08:00
Shun Sakai
58d9fa3820 Add completions for .NET 2020-12-19 16:55:24 -08:00
ridiculousfish
6f2e377fcc Clean up some unnecessary variable names in maybe.h 2020-12-19 16:10:40 -08:00
ridiculousfish
0028dce9ed Add a centos7 Dockerfile
This tests building and running on centos7 with gcc 4.8.
To run it:

    ./docker/docker_run_tests.sh ./docker/centos7.Dockerfile
2020-12-19 15:17:42 -08:00
ridiculousfish
f61f45748e Document insert-line-under and insert-line-over bindings 2020-12-19 14:32:17 -08:00
ridiculousfish
90f4c458e5 Rename insert_line_above to insert_line_over
This is for symmetry with insert_line_under. See #7442.
2020-12-19 14:31:33 -08:00
ridiculousfish
2d2efc8b2e Implement o and O bindings for vi mode
Credit to @joallard for the patch. Fixes #7442
2020-12-19 14:28:00 -08:00
Fabian Homborg
7e7355bde1 Restore $status after expanding completions
When a completion's "--arguments" script ran, it would clobber $status with its value,
so when you repainted your prompt, it would now show the completion
script's status rather than the status of what you last ran.

Solve this by just storing the status and restoring it - other places
do this by calling exec_subshell with apply_exit_status set to false,
which does basically the same thing. We can't use it here because we
don't want to run a "full" script, we only want the arguments to be
expanded, without a "real" command.

No, I have no idea how to test this automatically.

Fixes #7555.
2020-12-19 11:37:01 +01:00
Fabian Homborg
75dcbed700 Remove some useless uses of no-scope-shadowing
This is a very delicate tool, and these completions simply don't need them.
2020-12-16 18:31:51 +01:00
Fabian Homborg
39263fc92d Some refinemens to the CHANGELOG
Remove some bits from the significant changes, add some others, expand
on some points.

[ci skip]
2020-12-16 17:38:26 +01:00
Fabian Homborg
8087f603ad Stub out __has_attribute if not defined
Otherwise compilers that don't even have __has_attribute fail.

Fixes #7554
2020-12-16 17:06:48 +01:00
Fabian Homborg
1083cd2640 Benchmarks: Make seq_echo benchmark longer
This took ~12ms on my system, which is too short to see much more than
startup time.
2020-12-15 18:17:13 +01:00
Fabian Homborg
31166f4731 Simplify some duplicated path checks
This has one functional difference, in that we now report non-EACCESS
errors even for relative paths. I consider that to be a plus.

Some other sites might benefit from this, let's look into that later.
2020-12-15 18:15:59 +01:00
Fabian Homborg
0f6669f43c Stop using env_var_t::to_list in a few places
We don't need the entire list in modifiable form here - some just needs
the size, the others can just get a reference.
2020-12-15 15:47:44 +01:00
Jason
b0dcfac2a0 Update find.fish 2020-12-15 14:42:03 +01:00
Fabian Homborg
b4cf910e55 Add a benchmark for math
Results after 14908322a9, compared to 3.1.2:

math.fish
fish
  rusage self:
      user time: 916 ms
       sys time: 39 ms
     total time: 955 ms
        max rss: 35028 kb
        signals: 0
build/fish
  rusage self:
      user time: 769 ms
       sys time: 60 ms
     total time: 829 ms
        max rss: 34868 kb
        signals: 0
Benchmark #1: fish benchmarks/benchmarks/math.fish > /dev/null
  Time (mean ± σ):     955.2 ms ±  32.5 ms    [User: 897.2 ms, System: 57.9 ms]
  Range (min … max):   896.3 ms … 1002.5 ms    10 runs

Benchmark #2: build/fish benchmarks/benchmarks/math.fish > /dev/null
  Time (mean ± σ):     840.3 ms ±  21.5 ms    [User: 784.4 ms, System: 54.8 ms]
  Range (min … max):   802.4 ms … 869.0 ms    10 runs

Summary
  'build/fish benchmarks/benchmarks/math.fish > /dev/null' ran
    1.14 ± 0.05 times faster than 'fish benchmarks/benchmarks/math.fish > /dev/null'
2020-12-15 08:09:39 +01:00
Fabian Homborg
14908322a9 Also include fallback.h
GRrrrrr
2020-12-14 23:23:00 +01:00
Fabian Homborg
0f5a226e2f math: Use fish_wcstod instead
1. This should be using our wcstod_l on platforms where we need
it (for some reason it wasn't picking it up on FreeBSD?)

2. This purports to have a "fast path". I like fast paths.
2020-12-14 23:09:01 +01:00