Commit Graph

9741 Commits

Author SHA1 Message Date
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
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
07e03dd794 Release notes for #5426 2019-01-21 20:08:38 -06:00
Mahmoud Al-Qudsi
462cb6044c Use standard __CYGWIN__ define for Cygwin detection 2019-01-21 20:06:16 -06: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
Sam Yu
afb9094b4c Fix completion of directories for configure 2019-01-21 17:21:28 -08:00
Fabian Homborg
f2a1130afd Also set the read-only flag for non-electric vars
For some reason, we have two places where a variable can be read-only:

- By key in env.cpp:is_read_only(), which is checked via set*

- By flag on the actual env_var_t, which is checked e.g. in
  parse_execution

The latter didn't happen for non-electric variables like hostname,
because they used the default constructor, because they were
constructed via operator[] (or some such C++-iness).

This caused for-loops to crash on an assert if they used a
non-electric read-only var like $hostname or $SHLVL.

Instead, we explicitly set the flag.

We might want to remove one of the two read-only checks, or something?

Fixes #5548.
2019-01-21 17:14:01 -08:00
Aaron Gyes
3115446a07 string completions: add missing upper, lower, split0, join0, unescape
and --style=regex
2019-01-21 17:08:49 -08:00
Aaron Gyes
8743961301 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-21 13:59:36 -08:00
Aaron Gyes
a5e5f90f73 ls.fish: fix colorless ls not taking options
That -- no-op would have the effect that a user can not pass more
options to ls, they would be interpreted as file names.
2019-01-21 07:52:26 -08:00
Aaron Gyes
488e208cca ls.fish: also show indicators on non-GNU ls, refactor
GNU ls's --indicator-style=classify is the same as POSIX -F.

Refactor and change command testing logic so that we define the
function in the same place for all platforms, and use -F on all
the platforms when stdout is a TTY.
2019-01-21 06:56:57 -08:00
Aaron Gyes
5dc0ff0a90 ls.fish: remove for loop
`command -s` can take multiple arguments to try.
2019-01-21 03:15:43 -08:00