Commit graph

9237 commits

Author SHA1 Message Date
ridiculousfish
5c994b0d47 Only inherit a PWD if it resolves to "."
Fixes #5647
2019-02-18 14:32:15 -08:00
David Adam
e26ab3d81c Bump version for 3.0.1 2019-02-11 20:13:15 +08:00
David Adam
339b195e74 CHANGELOG: updates for 3.0.1 2019-02-11 20:13:15 +08:00
Aaron Gyes
4c6b4188a0 Drastically improve fish completions
* complete .fish files
* --debug -> --debug-level
* add --init-command/-C
* add --debug-stack-frames/-D
* add --private/-P
* add --features/-f: lists supported features, supports foo,<TAB>
* -c now completes commands
* -d requires argument, describes 0..5
* --profile: require argument, allow file completion
2019-02-10 21:27:26 -08:00
David Adam
be47d46e6a CHANGELOG: updates for 3.0.1 2019-02-10 17:07:59 +08:00
Fabian Homborg
0c706e45eb docs/tutorial: Remove mention of caret (^)
While this is still technically included, the tutorial should not
steer people towards it.

[ci skip]
2019-02-09 18:51:23 +01:00
Aaron Gyes
cfd9b52080 string completions: add -e, -f, --no-empty, shorten -d's
I hope this is now complete.

Also, shorten enough descriptions to make `string match --<TAB>`
show a two column pager with 80 cols.

We really should have shown more retraint in the design of `string`,
not all of the flags required both a long and short option created.
2019-02-07 04:20:12 -08:00
David Adam
c9e529951b Documentation for while: note updated exit status
From updates in #4982.

(cherry picked from commit 4cc168ae11)
2019-02-04 22:39:01 +08:00
Mahmoud Al-Qudsi
4dfaa33d95 Switch to wait_by_process when waitpid without WNOHANG returns nothing
By exclusively waiting by pgrp, we can fail to reap processes that
change their own pgrp then either crash or close their fds. If we wind
up in a situation where `waitpid(2)` returns 0 or ECHLD even though we
did not specify `WNOHANG` but we still have unreaped child processes,
wait on them by pid.

Closes #5596.
2019-02-02 16:06:29 -06:00
Fabian Homborg
93c0d3f4a5 functions -q: Return false without an argument
This erroneously listed functions and returned true.
2019-02-02 14:12:31 +01:00
Ashe Connor
bfa051e466 ***.fish* -> **.fish`
(cherry picked from commit c7635ed2c0)
2019-01-31 22:05:13 +08:00
Ashe Connor
f0c03ab73e fix "are equivalent" with same example
This was introduced in 87eb073 when ^ redirection was removed from the
docs.

(cherry picked from commit 09ca268d50)
2019-01-31 22:05:13 +08:00
Ashe Connor
9103dc2c23 pcre2 -> regex
(cherry picked from commit d9d2ad1cd6)
2019-01-31 22:05:12 +08:00
Fabian Homborg
a958617425 CHANGELOG: Vi-mode-spinning
The last bit for 3.0.1

[ci skip]
2019-01-28 21:26:10 +01:00
Fabian Homborg
8feabae131 Quit immediately with R_EOF
If we read an R_EOF, we'd try to match mappings to it.

In emacs mode, that's not an issue because the generic binding was
always available, but in vi-normal mode there is no generic binding,
so we'd endlessly loop, waiting for another character.

Fixes #5528.
2019-01-28 18:20:57 +01:00
Fabian Homborg
28ee5716fb default_command_not_found_handler: Only use $argv[1]
That's probably the nicer fix, otherwise this would print things like

    Unknown command 'aiohsd 1 2 3'

when it should just say

    Unknown command aiohsd
2019-01-26 21:53:32 +01:00
Fabian Homborg
368787060b CHANGELOG: Add the PRs
I missed the PRs without associated issue.

[ci skip]
2019-01-26 21:36:27 +01:00
Fabian Homborg
0d0a686ea2 CHANGELOG: Update for 3.0.1
This should now contain all closed issues for 3.0.1.

[ci skip]
2019-01-26 21:34:51 +01:00
Fabian Homborg
77b7f5513e default_command_not_found_handler: Join arguments
Without it, this would print the error multiple times, like

    Unknown command: echs
    Unknown command: 1
    Unknown command: 2
    Unknown command: 3

Fixes #5588.
2019-01-26 21:22:55 +01:00
Mahmoud Al-Qudsi
a5ef1e395e Use standard __CYGWIN__ define for Cygwin detection
(cherry picked from commit 462cb6044c)
2019-01-23 17:46:07 -06:00
Mahmoud Al-Qudsi
91ac0f1b18 Work around for Cygwin's broken job control resolving fish 3.0 hang
(cherry picked from commit d1913f0df0)
2019-01-23 17:46:00 -06:00
John McKay
e462c6fe0e print --help to stdout like other builtins (#5495) 2019-01-23 12:00:56 -08:00
Aaron Gyes
b5cbdc9065 fish_config: make clear python 2 or 3 will both work.
A person stuck installing it just for fish on their server
doesn't want to waste time installing the wrong one, so assuage that.

Also tweak to look nicer with 80 columns
2019-01-23 11:59:29 -08:00
Aaron Gyes
3bf702067a fish_config: tell the user some nice things without Python
As discussed in #5492, it would be good if running fish_config without
Python actually told the user to install Python.

Further, let's give the person some hints on how to configure these
things by hand, since they may have to.
2019-01-23 11:59:22 -08:00
Aaron Gyes
5b12d703dd Fix fish_config rendering brights as normal on prompt previews
I noticed our default brgreen for fish_color_user was rendering
as just unstyled white.
2019-01-23 11:58:29 -08:00
Aaron Gyes
e8f340a03d string completions: add missing upper, lower, split0, join0, unescape
and --style=regex
2019-01-23 11:58:12 -08:00
Mahmoud Al-Qudsi
aee8e5250a Add missing define for HAVE_WCSTOD_L to osx/config.h
I believe this should take care of the reported problem with the
corrected definition for `wcstod_l`. For future reference, any changes
to `config.h.in` should also be reflected in `osx/config.h`
2019-01-23 14:05:51 +01:00
Mahmoud Al-Qudsi
55526947d2 Fix locale_t under macOS 10.10
`xlocale.h` is not available on Linux, so we can't just universally
include it.

`HAVE_XLOCALE_H` was already being tested/set in the CMake script as a
possible requirement for `wcstod_l` support, this just adds it to
`config_cmake_h.in` and uses it in `wutil.h` to gate the include.
2019-01-23 14:05:51 +01:00
Mahmoud Al-Qudsi
8737b654bf Fix wcstod_l detection under Linux
This was broken in a8eb02f9f5 when the
detection was corrected for FreeBSD. This patch makes the detection work
for both Linux and FreeBSD instead of one or the other (tested).
2019-01-23 14:05:51 +01:00
Mahmoud Al-Qudsi
0f2470d45a Fix unsafe locale usage in wcstod_l fallback
Using `setlocale` is both not thread-safe and not correct, as
a) The global locale is usually stored in static storage, so
   simultaneous calls to `setlocale` can result in corruption, and
b) `setlocale` changes the locale for the entire application, not
   just the calling thread. This means that even if we wrapped the
   `wcstod_l` in a mutex to prevent the previous point, the results
   would still be incorrect because this would incorrectly influence the
   results of locale-aware functions executed in other threads while
   this thread is executing.

The previous comment mentioned that `uselocale` hadn't worked. I'm not
sure what the failing implementation looked like, but `uselocale` can be
tricky. The committed implementation passes the tests for me under Linux
and FreeBSD.
2019-01-23 14:05:50 +01:00
Mahmoud Al-Qudsi
3875615f45 Define _GNU_SOURCE for wcstod_l check 2019-01-23 14:05:50 +01:00
Mahmoud Al-Qudsi
70f618d598 Fix wcstod_l detection under FreeBSD 2019-01-23 14:05:50 +01:00
Fabian Homborg
c20187e858 completions/git: Stop offering :/ files so much
Don't do it when the relative path is simple (purely descending),
unless the token starts with ":/".

Also stop offering directories - if they need to be disambiguated, the
normal completion logic will take care of that.

Fixes #5574.

[ci skip]
2019-01-23 14:04:19 +01:00
Fabian Homborg
da44ee1d08 Don't wait for disowned pgids if they are special
If a job is disowned that, for some reason, has a pgid that is special
to waitpid, like 0 (process with pgid of the calling process), -1 (any
process), or our actual pgid, that would lead to us waiting for too
many processes when we later try to reap the disowned processes (to
stop zombies from appearing).

And that means we'd snag away the processes we actually do want to
wait for, which would end with us in a waiting loop.

This is tough to reproduce, the easiest I've found was

    fish -ic 'sleep 5 &; disown; set -g __fish_git_prompt_showupstream auto; __fish_git_prompt'

in a git repo.

What we do is to not allow special pgids in the disowned_pids list.
That means we might leave a zombie around (though we probably wait on
0 somewhere), but that's preferable to infinitely looping.

See #5426.
2019-01-23 12:31:55 +01:00
Johannes Altmanninger
1d80028e24 __fish_complete_man.fish: escape for regex
Previously, using special regex characters or slashes would result in an
error message, when pressing tab in a command-line such as
"man /usr/bin/time ".
2019-01-23 11:59:06 +01:00
Mahmoud Al-Qudsi
a1df72dbb6 Fix wcstod_l infinite recursion under FreeBSD
This was the actual issue leading to memory corruption under FreeBSD in
issue #5453, worked around by correcting the detection of `wcstod_l` so
that our version of the function is not called at all.

If we are 100% certain that `wcstod_l` does not exist, then then the
existing code is fine. But given that our checks have failed seperately
on two different platforms already (FreeBSD and Cygwin/newlib), it's a
good precaution to take.
2019-01-23 00:12:17 -06:00
Fabian Homborg
72423c517a webconfig: Fix binding tab
This broke when --preset was introduced.

We allow a "--preset" or "--user" to appear right after the "bind",
and save the value, but don't use it yet.

Fixes #5534.

[ci skip]
2019-01-22 14:55:37 -08:00
ridiculousfish
88ee55443c Update docs on tab completions and searching
Fixes #5547
2019-01-22 14:44:09 -08:00
ridiculousfish
6bd3474daf Make control-S begin navigating the pager contents
In addition to showing the search field, actually allow the user to type in
it.
2019-01-22 14:43:44 -08:00
ridiculousfish
dfa61926e8 Correctly inherit a virtual PWD
PWD is not set in fish vars because it is read only.
Use getenv() to fetch it, allowing fish to inherit a virtual PWD.

This cherry pick includes both:
24f251e04 Correctly remove the test directory again in cd test
91a9c9897 Correctly inherit a virtual PWD

Fixes #5525
2019-01-22 14:10:50 -08:00
Fabian Homborg
d88be7b5c8 tests/cd: cd back before cleaning up
Otherwise this'd run afoul of OpenIndiana's "no removing $PWD" rule. Spoilsports!

See #5472.
2019-01-22 14:04:27 -08:00
Mahmoud Al-Qudsi
1b551e553b Fix regression for #4178 and others introduced by 364c839
...while still keeping intact the fix for #5519.
2019-01-22 12:39:37 -06:00
Fabian Homborg
963e3217e5 env_get_runtime_path: Check for getpwuid() failure
Otherwise this is a NULL dereference and then crash.

Fixes #5550.
2019-01-22 19:33:22 +01:00
Fabian Homborg
91ecd3b9b5 completions/git: Skip "!" shell-aliases for wrapping
We can't complete these, and now the user can do

```
set -g __fish_git_alias_$alias $command
```

e.g.

```
set -g __fish_git_alias_co checkout
```

if the arguments in the alias end up going to `git alias`.

Fixes #5412.

[ci skip]
2019-01-22 19:18:00 +01:00
Fabian Homborg
288cfa8fb2 completions/git: Also don't use files for porcelain=2
This was an oversight from the previous commit. Not that it matters
much, because we already removed $files.

Still, this would fail if someone defined a global $files, so let's fix it.

[ci skip]
2019-01-22 19:16:29 +01:00
Fabian Homborg
171ae99295 Don't ASSERT_IS_NOT_FORKED_CHILD so much
This is hammered sooo much that it actually hurts performance.

    for i in (seq 100000); test 1 = 1; end

is about 40% (!) slower with it.
2019-01-21 18:21:00 -08:00
Fabian Homborg
96f7924661 Fix nim prompt (via web_config)
This had a helper function defined outside of the fish_prompt
function, so `funcsave` missed it (see #736).

Fixes #5490.

[ci skip]
2019-01-21 18:09:39 -08:00
Mahmoud Al-Qudsi
ec77135cf2 Allow more flexibility with file completions for yarn
Closes #5502
2019-01-21 17:41:16 -08:00
Mahmoud Al-Qudsi
d5d80c0742 Fix extra space in fish_title
Closes #5517. Credit goes to @jadenPete.

[skip-ci]
2019-01-21 17:27:35 -08:00
Fabian Homborg
97f0cc9662 Don't wrap functions with themselves
Our weird %-expanding function wrappers around kill et all defined
"--wraps" for the same name.

As it turns out, fish follows that one, and executes the completion
multiple times.

I didn't notice because these tend to be rather quick on linux, but on
macOS that's apparently a real issue.

Fixes #5541.

[ci skip]
2019-01-21 17:24:49 -08:00