Commit Graph

9389 Commits

Author SHA1 Message Date
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
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
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
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
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
ridiculousfish
3cc581fbb0 Unconditionally set the tty mode in reader_readline
There was a bogus check for is_interactive_session. But if we are in
reader_readline we are necessarily interactive (even if we are not in
an interactive session, i.e. a fish script invoked some interactive
functionality).

Remove this check.

Fixes #5519
2019-01-20 17:36:31 -08:00
ridiculousfish
1680b741b2 Make while loops evaluate to the last executed command status
A while loop now evaluates to the last executed command in the body, or
zero if the loop body is empty. This matches POSIX semantics.

Add a bunch of tricky tests.

See #4982
2019-01-20 16:37:20 -08:00
ridiculousfish
fec10830d3 Correctly handle exited jobs in process_mark_finished_children
This is effectively a pick of 2ebdcf82ee
and the subsequent fixup. However we also avoid setting WNOHANG unless
waitpid() indicates a process was reaped.

Fixes #5438
2019-01-20 15:07:08 -08:00
ridiculousfish
e490372fbf Relnote fix for #5449 2019-01-20 13:56:42 -08:00
ridiculousfish
2a190c6f3b exec to only warn on background jobs in interactive sessions
Extension of fix for #5449 in b007248
2019-01-20 13:53:11 -08:00
Fabian Homborg
c66b3128ec Use wcstod_l on NetBSD
It has wcstod_l, but not uselocale, so we can't use the fallback.
2019-01-20 18:35:38 +01:00
Mahmoud Al-Qudsi
f90cb3957f 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-20 16:40:50 +08:00
ridiculousfish
b1f5cb9bf4 Revert "Revert "Fix unsafe locale usage in wcstod_l fallback""
This reverts commit c15a702f18.

The tests are no longer broken after rerunning CMake.
2019-01-19 13:27:28 -08:00
Fabian Homborg
3847d2e9d1 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-18 19:27:41 +01:00
Aaron Raimist
1398ee9bbb docs: list full command to change default shell 2019-01-18 10:38:12 +01:00
Dan Zimmerman
857561ca14 Fix warnings when compiling on macos
These warnings were appearing and annoying me so Im making a PR to fix
them.
2019-01-17 13:56:17 -06:00
Fabian Homborg
34ed958f72 Test that things can't wrap themselves
This is a test belonging to the previous commit, 58b696bed.

See #5541.
2019-01-17 16:46:15 +01:00
Sam Yu
02c32c638f Fix completion of directories for configure 2019-01-17 10:13:27 +01:00
Fabian Homborg
58b696bed1 complete: Don't allow wrapping a command with itself
Double-fixes #5541, by not allowing it to happen.
2019-01-17 09:49:50 +01:00
Fabian Homborg
84339d5636 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-17 09:46:55 +01:00
Mahmoud Al-Qudsi
1b23814f8b Clarify the point of type --force-path [docs]
[ci skip]
2019-01-16 17:42:11 -06:00
Mahmoud Al-Qudsi
dd31933c09 Remove spurious initialization in profiling_cmd_name_for_redirectable_block 2019-01-16 15:48:25 -06:00
Mahmoud Al-Qudsi
20cdcfadac Remove write-only assignments from autload.cpp 2019-01-16 15:46:11 -06:00
Mahmoud Al-Qudsi
53355885c8 Clean up dead code in builtin_read.cpp 2019-01-16 15:44:10 -06:00
Mahmoud Al-Qudsi
333bf1fd9f Remove write-only desc_width local variable 2019-01-16 15:38:27 -06:00
Mahmoud Al-Qudsi
bad3c5d79d Remove dead assignment and clarify ENV_NOT_FOUND behavior for set -e 2019-01-16 15:27:23 -06:00
Aaron Gyes
fb74ccb1f2 set's color completions: remove Color description.
On `set fish_color_cwd <TAB>`, a bunch of named colors are
shown in the pager. Each and every one has a description of "Color".

These are all very obviously colors, and none are not colors,
the description does not tell us anything specific about the item.

Descriptions in situations like this are actually a hinderance
because of the way they cause less to fit into the pager. Remove it
2019-01-16 10:34:16 -08:00
Fabian Homborg
de32665939 tests/invocation: Disable set -e
There's just waaayy too many things that could go wrong with it, so it
annoys more than it helps, especially since we don't get any
indication what failed.

E.g. on FreeBSD, the test failed without a usable message just because
`tput` couldn't find an attribute (so colors were unset).
2019-01-16 12:01:00 +01:00
Fabian Homborg
6c1a2c1f30 tests: Don't use mktemp -u
This works around a bug on FreeBSD 11.
2019-01-16 12:01:00 +01:00
Fabian Homborg
5779d99a81 fish_vi_cursor: Check for tput before using
If tput isn't available, that's the same as if it failed.

This is the last bit necessary to make the tests work on alpine on builds.sr.ht.
2019-01-16 11:08:47 +01:00
Fabian Homborg
c9fe59237b webconfig: Allow \co sgr0 in one more place
Some $TERMs like tmux and linux use an sgr0 ("reset") value that ends
in \co instead of "m". We need to adjust our regex here to catch that,
or we'd miscount lines with it.
2019-01-16 10:23:53 +01:00
Fabian Homborg
d7dac4d077 webconfig: Use history -z
This did some weird stuff with \x1e.

[ci skip]
2019-01-16 09:32:26 +01:00
Fabian Homborg
2b426c1047 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-16 09:32:26 +01:00
Aaron Gyes
2abd0cde85 builtin_printf.cpp: remove is_hex_digit, redo is_octal_digit
Our is_hex_digit() was redundant, we can just use iswxdigit; the libc
implementation is a more efficient table lookup anyhow.

Do is_octal_digit() in terms of iswdigit instead of using wcschr.
2019-01-15 02:05:12 -08:00
Aaron Gyes
c94adb9d3e 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-14 03:29:57 -08:00
Aaron Gyes
7d16714dd3 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-14 03:08:44 -08:00
Mahmoud Al-Qudsi
03cdf89bfd Add tests for $status after while in various scenarios
Includes a regression test for #5513 and asserts the behavior defined in
\#4982.
2019-01-13 18:58:48 -06:00
Mahmoud Al-Qudsi
027fc43736 Fix result after explicit return in a while block
Closes #5513.
2019-01-13 18:56:19 -06:00
Mahmoud Al-Qudsi
2fdcc4544a Fix extra space in fish_title
Closes #5517. Credit goes to @jadenPete.

[skip-ci]
2019-01-13 16:14:58 -06:00
Fabian Homborg
6d11e46428 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-13 21:33:00 +01:00
Fabian Homborg
787f453ec2 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-13 17:20:10 +01:00