Commit Graph

8720 Commits

Author SHA1 Message Date
Kevin Ballard
f7ba2a6a00 Don't corrupt memory when setting a slice with wrong # of args
Fixes #4881.
2018-04-10 21:09:31 +08:00
Wilke Schwiedop
5d01399586 add file readability-test 2018-04-09 01:09:49 +02:00
Wilke Schwiedop
8ae9b716a0 fix 'grep ... | sed' 2018-04-09 01:09:49 +02:00
Wilke Schwiedop
bd24e8662e fix 'sort | uniq' 2018-04-09 01:09:49 +02:00
Thom Chiovoloni
25169a44ed Add alias -s/--save, which saves the alias.
Also updates the `alias` documentation to mention the `-h`/`--help` option,
which was previously undocumented.
2018-04-09 01:08:56 +02:00
George Christou
6c0f31d622 completions: [git] Use builtin git truncation 2018-04-09 01:07:52 +02:00
George Christou
c6e7b7ef00 prompt: Show untracked Git files relative to root directory (#4874)
* prompt/git: Match untracked files relative to root directory

* prompt/git: Move untracked file logic to a separate function
2018-04-09 01:05:03 +02:00
Fabian Homborg
01f24f2df6 Fix typo in emacs completions
Fixes #4885.

[ci skip]
2018-04-09 00:46:35 +02:00
Mahmoud Al-Qudsi
366933413b Fix string match argument parsing in __fish_seen_argument 2018-04-03 21:13:11 -05:00
Mahmoud Al-Qudsi
d8a1928c24 Convert list of builtins from sorted array to unordered_set
The order of this list does not need to be strictly maintained any
longer.

Benchmarked with `hyperfine` as follows, where `bench1` is the existing
approach of binary search and `bench2` is the new unordered_set code,
(executed under bash because fish would always return non-zero). The
benchmark code checks each argv to see if it is a builtin keyword (both
return the same result):

```
hyperfine './bench1 $(shuf /usr/share/dict/words)' './bench2 $(shuf /usr/share/dict/words)'
Benchmark #1: ./bench1 $(shuf /usr/share/dict/words)

  Time (mean ± σ):      68.4 ms ±   3.0 ms    [User: 28.8 ms, System: 38.9 ms]

  Range (min … max):    60.4 ms …  75.4 ms

Benchmark #2: ./bench2 $(shuf /usr/share/dict/words)

  Time (mean ± σ):      61.4 ms ±   2.3 ms    [User: 23.1 ms, System: 39.8 ms]

  Range (min … max):    58.1 ms …  67.1 ms

Summary

'./bench2 $(shuf /usr/share/dict/words)' ran
    1.11x faster than './bench1 $(shuf /usr/share/dict/words)'
```
2018-04-03 15:47:21 -05:00
Mahmoud Al-Qudsi
c492d03f51 Overhaul completions for set and add new completions for set -e
Now the description includes the variable scope, `set [-e] -[Ugl]`
completions only provide variables matching that scope, and completions
that shouldn't be modified are hidden from the user. Completions that
are often modified but rarely unset (`fish_*` variables) are omitted
from `set -e` completions.

A new helper function `__fish_seen_argument` has been added that makes
it easy to only provied completions for a specific flag.
2018-04-03 14:42:26 -05:00
Mahmoud Al-Qudsi
cc50103e53 Unblock builtins from completions
The `head_exists` value was being reset after being set to true for most
builtins, causing completions to not trigger.
2018-04-03 14:05:11 -05:00
Mahmoud Al-Qudsi
99ecaec175 Use system web browser under WSL
Launch `cmd.exe /c "start URL"` under WSL for both `fish_config` and
`help`. This works around #4299 but does not address the underlying
issue (#1132).
2018-04-02 18:36:14 -05:00
ridiculousfish
358e9def5b Fix the git completion
Commit 6e56637cf ran fish_indent on the git completion and mangled some
of it. Manually revert the non-essential changes.
2018-04-02 10:26:40 -07:00
David Adam
61ab3aea8c webconfig: import webbrowser with empty TERM
Re-introduces the changes from 168d25e780
which were inadvertently removed in
20bcbcc252.

Work on #4299. Re-commit of #1132.
2018-04-02 21:35:10 +08:00
David Adam
5c56765d12 hg prompt: fix infinite loop due to incorrect scoping
4b079e16e5 fixed some unintended behaviour
which the hg prompt was apparently relying upon, producing an infinite
loop whenever called.
2018-04-02 21:24:52 +08:00
ridiculousfish
f922875dbc Fix the Linux build 2018-04-01 17:59:42 -07:00
ridiculousfish
a98cc75f9e Reword warning inside fish_universal_variables file
Prior to this fix, the fish universal variables file claimed that
changes to it would be overwritten. This no longer true and has not
been true for a long time. Remove that warning.
2018-04-01 17:51:53 -07:00
ridiculousfish
ba8bdbb3ae Reference issue for removing uvars MAC address in CHANGELOG 2018-04-01 17:47:43 -07:00
ridiculousfish
0d0a65dc87 CHANGELOG removal of MAC address from uvars file
Part of #1912
2018-04-01 17:46:02 -07:00
ridiculousfish
ff10e504a1 Remove MAC address from universal variables file
This switches the universal variables file from a machine-specific
name to the fixed '.config/fish/fish_universal_variables'. The old file
name is migrated if necessary.

Fixes #1912
2018-04-01 17:43:12 -07:00
ridiculousfish
ca13e816ce Make fish more resilient to empty key bindings
If fish_key_bindings gets set to empty, fish will become unusable.
In this case reset it to fish_default_key_bindings.
2018-04-01 16:11:12 -07:00
ridiculousfish
222a45f07a Add acquire() to maybe_t
Easy way to pull the value out.
2018-04-01 16:10:59 -07:00
Peter Ammon
5b489ca30f Remove caret redirection
This removes the caret as a shorthand for redirecting stderr.

Note that stderr may be redirected to a file via 2>/some/path...
and may be redirected with a pipe via 2>|.

Fixes #4394
2018-04-01 13:48:21 -07:00
Peter Ammon
7659554dea Remove use of caret redirection from share/*
This removes the use of caret redirections from share/completions
and share/functions, in preparation for dropping support in fish.
2018-04-01 13:42:38 -07:00
Mahmoud Al-Qudsi
95e5af7814 fixup! Handle set -e result ENV_NOT_FOUND in tests 2018-03-31 22:25:38 -05:00
Mahmoud Al-Qudsi
95712125c9 Handle set -e result ENV_NOT_FOUND in tests 2018-03-31 22:21:22 -05:00
Mahmoud Al-Qudsi
01452da5bf Add and use new exit code for env_remove() when var doesn't exist
The previous commit caused the tests to fail since env_remove() was
returning a blanket `!0` when a variable couldn't be unset because it
didn't exist in the first place. This caused the wrong message to be
emitted since the code clashed with a return code for `env_set()`.

Added `ENV_NOT_FOUND` to signify that the variable requested unset
didn't exist in the first place, but _not_ printing the error message
currently so as not to break existing behavior before checking if this
is something we want.
2018-03-31 22:12:52 -05:00
Mahmoud Al-Qudsi
0e0168ef18 Display error message on set -e PROTECTED
Previously unsetting a variable would fail silently. Now sharing error
printing code from regular `set PROTECTED` call.
2018-03-31 21:44:54 -05:00
ridiculousfish
abcc9647da Fix some unused variable warnings 2018-03-31 17:06:13 -07:00
ridiculousfish
6e56637cf0 Remove support for the ? wildcard
Fixes #4520
2018-03-31 16:54:50 -07:00
ridiculousfish
4b079e16e5 Execute the conditions of if and while statements outside of their block
Variables set in if and while conditions are in the enclosing block, not
the if/while statement block. For example:

    if set -l var (somecommand) ; end
    echo $var

will now work as expected.

Fixes #4820. Fixes #1212.
2018-03-31 14:57:24 -07:00
ridiculousfish
ba06a89923 Update legacy Xcode build to use tinyexpr instead of muParser
Fixes #4838
2018-03-31 13:24:19 -07:00
Samuel Gagnon
dae0dd513d Fixes the FAQ questions in the sidebar of user_doc/html/index.html 2018-03-31 12:18:37 -07:00
slama
f93d1c963f removed explanation of process expansion in doc 2018-03-31 12:12:27 -07:00
slama
d88866ccf7 deleted no longer necessary codes due to removing process expansion. 2018-03-31 12:12:27 -07:00
ridiculousfish
c0f832a743 Invoke path_helper on macOS on all sessions, not just login
fish reads paths out of /etc/paths.d. Prior to adbaddf it did
this on every shell invocation; with adbaddf it does so on only login
shells. This change wasn't justified so let's revert this behavior.
2018-03-31 12:01:29 -07:00
Fabian Homborg
535617623b Make pager background cover the entire candidate
Currently, there are two possibilities for holes in the background:

- When there are two candidates with the same meaning (a long and a
  short option or two candidates with the same description)

- When a candidate does not have a description (meaning the color
  won't continue after it)

This changes both so the background just goes on.

In addition, it avoids making the background multiple times.

Fixes #4866.
2018-03-31 13:04:30 +02:00
Mahmoud Al-Qudsi
04b8b35a56 Document new string split --no-empty option 2018-03-29 08:23:29 -05:00
Mahmoud Al-Qudsi
999728670d Default string split to keeping empty entries with option to remove
The official fish documentation makes no mention of how `string split`
treats empty tokens, e.g. splitting 'key1##key2' on '#' or (more
confusingly) splitting '/path' on '/'. With this commit, `string split`
now has an option to exclude zero-length substrings from the resulting
array with a new `--no-empty/-n`. The default behavior of preserving
empty entries is kept so as to avoid breakage.
2018-03-29 08:12:08 -05:00
Mahmoud Al-Qudsi
412c5aeaa6 Use alternative Unicode glyphs if compiled under Windows/WSL
The two unicode glyphs used to represent missing new lines and redacted
characters for secure entry are both not present in the glyph tables of
the default font under Windows (Consolas and Lucida Console), use an
alternative glyph instead.

The "return" symbol is replaced with a pilcrow (¶) and the "redacted
character" symbol is replaced with a bullet (•). Both of these are
well-defined in almost all fonts as they're very old symbols. This
change only takes place if -DWSL is supplied by the build toolchain.

Note: this means a Windows SSH client connecting to a fish remote
instance on a non-Windows machine will still use the (unavailable)
default glyphs instead.
2018-03-28 14:27:25 -05:00
Frederick Akalin
adbaddfaf4 Fix reading of /etc/paths on OS X
(and /etc/paths.d/*)

Do so by emulating the behavior of /usr/libexec/path_helper for login
shells, matching the behavior in /etc/profile.

Also add a path_helper command to reproduce the behavior of
/usr/libexec/path_helper for fish.

This also handles setting MANPATH if necessary.

Fixes issue #4336
2018-03-27 23:38:15 -07:00
Luc J. Bourhis
c116843611 Completion for conda, the package manager (#4837)
* Completion for conda, the package manager

* Make the list of platforms a private variable

* Add commands activate and deactivate

* Avoid clobbering a user-defined function __

* Use Use __fish_seen_subcommand_from to identify subcommand

And treat the case of the first argument as a special case
with function __fish_conda_fist_arg

* Factor out create from loop for option --name

* Fix typo (missing parenthesis in description)

* Start from a blank state by removing completions from conda configuration script
2018-03-26 17:07:23 +02:00
Fabian Homborg
ad5bbeb3c2
Make wcwidth configurable (#4816)
* Make wcwidth configurable

This adds the cmake option "INTERNAL_WCWIDTH" (to be set to "ON" or
"OFF") and the configure option --[en,dis]able-internal-wcwidth.

Both default to enabling our fallback, but can be set to use the system's wcwidth again.

Sequel to #4554.
See #4571, #4539, #4609.

On my system, this would fix #4306.
2018-03-25 10:19:57 +02:00
ridiculousfish
669eafb55f Stop exporting empty variables as ENV_NULL
Localize the encoding of empty variables as ENV_NULL into the universal
variables component, and ensure they are not exported as ENV_NULL.

Fixes #4846
2018-03-24 23:42:09 -07:00
slama
233738d50a forget to set error message to the test with wait command in fish script. 2018-03-25 14:24:23 +09:00
slama
bb1956fd8d fix the problem that wait command doesn't work correctly in fish script. 2018-03-25 14:22:27 +09:00
slama
d078e47adc fix bug with test of wait command 2018-03-25 12:22:09 +09:00
slama
3be3f2e6a2 Update doc of wait command to reflect changes in supporting process names to wait. 2018-03-25 11:24:43 +09:00
Aaron Miller
517b77ca74 Fix handling of signals (#4851) 2018-03-24 12:37:15 -07:00