Commit graph

9654 commits

Author SHA1 Message Date
Aaron Gyes
aafefb2300 Report the guessed/effective emoji width with -d2 on startup
This will print out along with the stuff we've guessed about color
support. We get a lot of bug reports about these messing up rendering,
this is useful diagnostic output.
2019-01-25 13:51:20 -08:00
Aaron Gyes
290d07a833 env.cpp: Better fallback for missing PATH
Ask the system where utilities are available with confstr (POSIX).

This is the same string printed by `getconf PATH`, which likely
includes more directories.
2019-01-24 10:46:16 -08:00
Matan Kushner
4567d3ae52 Fix typo setting fish_color_error (#5577) 2019-01-23 17:34:28 -08:00
wyahiro
e9f0a8cf2c Redo ant completions
Closes #5475
2019-01-23 18:00:21 -06:00
Mahmoud Al-Qudsi
5adc07bf28 Document new type -p support for functions 2019-01-23 17:51:47 -06:00
Mahmoud Al-Qudsi
d651cdacbe Extend type --path to print path to script defining named function
Expands the utility of `type -p foo` by allowing it to print the path to
the script that defines `foo` when `foo` is a valid function that was
sourced from a path on disk (rather than interactively defined).

This does not change the behavior of `type -P`/`type --force-path`,
which should have already been used if the desire was to resolve the
path to an executable file (otherwise the output would have been blank
if a function was shadowing an executable file of the same namea), so no
backwards compatibility issues are expected.
2019-01-23 17:51:47 -06: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
Fabian Homborg
8079345207 tests/invocation.sh: Use a formatting string with printf
Using printf like

    printf "The message"

is unsafe, because if the message contains any formatting characters,
they'll be interpreted.

In this case it's not all that important because the message contains
only filenames of our tests and static strings, but still.
2019-01-23 22:53:53 +01:00
Aaron Gyes
4e391abe3c tests/invocation.sh: use printf to omit the newline again 2019-01-23 13:39:16 -08:00
Aaron Gyes
09d0f7741d set_color: don't set color to black before resetting attributes
I was surprised to see:

> set_color normal | string escape
\e\[30m\e\(B\e\[m

I only expected to see a sgr0 here.

Cleanup a nearby `else { if (...) {` and comment with a bogus example.
2019-01-23 13:37:52 -08:00
Fabian Homborg
a17e6fa4e8 tests/invocation: Remove one more echo -n
This one was purely cosmetic in the runner output.
2019-01-23 22:14:21 +01: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
Fabian Homborg
432ed621fd completions/git: Don't sort tags or commits
Sorting these alphabetically just makes no sense, but takes time.

[ci skip]
2019-01-23 15:53:47 +01: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
4af2a681b8 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:03:38 +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
Johannes Altmanninger
eee4dd8248 __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:58:30 +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
71b5591f21 Update docs on tab completions and searching
Fixes #5547
2019-01-22 14:41:16 -08:00
ridiculousfish
87b7b6b2bb 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:41:13 -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
ridiculousfish
24f251e044 Correctly remove the test directory again in cd test 2019-01-22 14:07:25 -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
ridiculousfish
91a9c98974 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.

Fixes #5525
2019-01-22 13:34:04 -08:00
Fabian Homborg
e97c27c177 CHANGELOG: Remove erroneous second "set --show" entry
This was added in 2.7.0 (confirmed by checking the tag), and it
already has an entry there, so the second entry in 3.0.0 is wrong.

[ci skip]
2019-01-22 21:55:19 +01: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
82b4d7225c env_get_runtime_path: Check for getpwuid() failure
Otherwise this is a NULL dereference and then crash.

Fixes #5550.
2019-01-22 19:30:04 +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
Aaron Gyes
b23403ee6b Revert "__fish_complete_suffix: do not show description when not passed one"
This reverts commit 367661d4f1.

This was the wrong way to address this annoyance of mine.
2019-01-21 22:55:56 -08:00
Aaron Gyes
23e94d8349 improve GNU patch completions
shorter descriptions that can fit in a terminal window, and option arguments added.

hide one option that is only functional on Cygwin unless we are on Cygwin
2019-01-21 22:37:45 -08:00
Aaron Gyes
367661d4f1 __fish_complete_suffix: do not show description when not passed one
Make it so that the generated completion has the form \t\n
when the optional description has been ommitted - otherwise
the original option's description gets inherited and is seen hundreds
of times repeating in the pager.
2019-01-21 22:37:45 -08:00
Mahmoud Al-Qudsi
0edaf42d10 Fix regression for #4178 and others introduced by 364c839
...while still keeping intact the fix for #5519.
2019-01-21 20:29:31 -06: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