Commit Graph

8344 Commits

Author SHA1 Message Date
Benoit Hamon
3819437e0e add option --handlers to functions to display function hooks 2018-03-10 02:18:46 -08:00
ridiculousfish
7764f27170 Correct failure to set 'filled' flag in maybe_t constructors 2018-03-10 02:17:35 -08:00
Mahmoud Al-Qudsi
f1803feebf Document deprecation of logical expression in math builtin
Closes #4777
2018-03-09 21:58:30 -06:00
Mahmoud Al-Qudsi
d9be55e504 Optimize sort_and_prioritize_completions
Don't continuously shift items in the vector by using std::remove_if
instead, followed by a single call to ->erase().
2018-03-09 21:40:03 -06:00
Mahmoud Al-Qudsi
b575e120cf Update changelog text, formatting, and dependencies
Closes #4422
2018-03-09 16:03:44 -06:00
Mahmoud Al-Qudsi
5cf67e20a5 Merge branch 'hostname'
This addresses the discussion regarding the dependency on `hostname` and
the addition of a `$hostname` variable to replace it.

`$hostname` is a read-only, GLOBAL_ENV, non-electrified, lowercased,
non-exported variable that is read once at the start of a fish session.
The finer points of this can be debated endlessly, but this is a shared
starting point that any changes can build on (ref #4422).

Regarding performance: @krader1961 brought up some good points in #4422
regarding potential DNS timeouts (but they really don't apply except if
the host name is not hardcoded in resolv.conf, which quickly manifests
with a cascade of errors on most *nix systems in all cases), but note
that gethostname() was already being called by fish so that would be
more of a future optimization than a "must" at this point.
2018-03-09 15:17:52 -06:00
Mahmoud Al-Qudsi
db6fd2c570 Document $hostname variable 2018-03-09 15:10:53 -06:00
Mahmoud Al-Qudsi
410f6fbd44 Switch prompt_hostname over to $hostname 2018-03-09 15:05:43 -06:00
Mahmoud Al-Qudsi
a756049dac Implement $hostname variable
The value is not electrified or tied and is read-only. It isn't cached
in the get_hostname_identifier() function as the ENV_GLOBAL $hostname
will cache it for its duration.
2018-03-09 15:02:32 -06:00
Mahmoud Al-Qudsi
ed9c0a7f82 Unify gethostname() behavior across different versions of libc
The behavior of `gethostname` in case of an insufficient buffer is
library and version dependent. Work around this by using a big enough
buffer then truncating the output to our desired max length.
2018-03-09 14:52:29 -06:00
Mahmoud Al-Qudsi
a991fd5a1a Add wcstringutil.h truncate function 2018-03-09 14:52:12 -06:00
Mahmoud Al-Qudsi
1fbf810946 Unify ellipsis_str[ing] with common variable set once 2018-03-09 14:40:35 -06:00
Mahmoud Al-Qudsi
3314135cc9 Move fixed test outside of input_mapping_is_match loop
The 0th index of the array was tested inside the loop instead of just
once outside it.

Also explain `input_mapping_is_match` control code behavior and
reasoning and simplify control flow.
2018-03-09 14:11:43 -06:00
Mahmoud Al-Qudsi
efb894fdae Fix read tests to reflect updated arguments 2018-03-09 12:19:20 -06:00
Mahmoud Al-Qudsi
ff20651d8b Clean up CHANGELOG.md with regards to read arguments
Removed misleading statement about read requiring an argument, as the
note about read's new behavior when no arguments are provided covers
that and is less confusing.
2018-03-09 12:07:09 -06:00
Mahmoud Al-Qudsi
9206734a4d Merge branch 'issue_4490' (read --silent/-s)
Closes #4490
2018-03-09 12:06:31 -06:00
Mahmoud Al-Qudsi
8b9a13f6ca Update read builtin documentation to reflect --shell and --silent opt changes 2018-03-09 12:03:45 -06:00
Mahmoud Al-Qudsi
eaa5958b77 Update completions for read builtin
Change short option for `--shell` to `-S` per #4490 and add description for -s/--silent
2018-03-09 11:59:50 -06:00
Mahmoud Al-Qudsi
2a266c4d48 Update fish's only usage of read -s to use read --shell instead 2018-03-09 11:55:12 -06:00
Mahmoud Al-Qudsi
f8ec1e4a7b Document `read -s/--silent and -S/--shell change 2018-03-09 11:53:19 -06:00
Mahmoud Al-Qudsi
86362e72fe Emit deprecation error when read -i is used for --silent 2018-03-09 11:48:51 -06:00
Mahmoud Al-Qudsi
db8ec59ac4 Change read to use -s/--silent and -S/--shell
Closes #4490
2018-03-09 11:48:20 -06:00
Mahmoud Al-Qudsi
b38ac1e35d Fix wait test with no process expansion 2018-03-09 10:50:43 -06:00
Mahmoud Al-Qudsi
a6f79dcca8 Implement -s for fish_vi_key_bindings
In similar vein to how fish_default_key_bindings works, parameters
passed to the function are automatically passed to bind upstream.
Additionally, -s is automatically added if no parameters had been
specified to prevent startup error messages. See 46d1334.

Closes #4494
2018-03-09 09:29:25 -06:00
Mahmoud Al-Qudsi
0866653a87 Merge branch 'no_percent'
Drops the % notation for process expansion. The existing notation was a
mess and expanded jobs, process ids, and process names via dark magic.
With this change, % is no longer a special character and can be used
unescaped with impunity.

The variables %self and %last, referring to fish's own pid and the pid
of the last backgrounded job respectively, have been replaced with $pid
and $last_pid. These are read-only variables, protected against being
redefined by the user.

Author's note: I would have personally preferred $fish_pid instead of
$pid but since we debated changing $version to $fish_version and then
reverted that change (with much acrimony), it makes no sense to break
with that precedent here. Additionally, $fish_last_pid is quite wordy.

Closes #4230. Closes #1202.
2018-03-09 09:16:31 -06:00
Mahmoud Al-Qudsi
827b8b9fd5 Document removal of % expansion and new $self/$last_pid variables 2018-03-09 09:15:29 -06:00
Mahmoud Al-Qudsi
26cc112096 Implement $last_pid, taking the place of %last
Set as a global variable upon the execution of a background job.
2018-03-09 08:56:13 -06:00
Mahmoud Al-Qudsi
f7e0cbc7a4 Drop % test for illegal commands
% is perfectly valid in commands, now :)
2018-03-09 04:02:29 -06:00
Mahmoud Al-Qudsi
b236ab6e5d Update %self references with $pid instead 2018-03-09 03:56:19 -06:00
Mahmoud Al-Qudsi
90d0f91bcd Define read-only $pid as %self replacement 2018-03-09 03:47:32 -06:00
Mahmoud Al-Qudsi
f42f7b7208 Clean up detritus of process expansion 2018-03-09 03:39:53 -06:00
Mahmoud Al-Qudsi
e45e2bf20e Initial removal of '%' syntax for process/job expansion 2018-03-09 03:36:10 -06:00
Patrick Häcker
9616b50461 Improve documentation of cartesian product with empty expansion (#4769)
* Improve documentation of cartesian product with empty expansion

* Fix review findings for documentation of empty cartesian product expansion
2018-03-08 22:42:32 +01:00
Samuel Gagnon
f02dd22973 Typo in documentation for "emit" command
Line \endfish is misplaced.
2018-03-08 12:55:35 +01:00
George Christou
73f2b444ef completions: [git] Do not decorate reflog 2018-03-07 22:01:23 +01:00
Fabian Homborg
2d08b5ee8a [math] Add tests for runtime errors
And fix "isinfinite" - it's called "isinf".
2018-03-07 18:13:26 +01:00
Fabian Homborg
9fc3d1215b [math] Check for runtime errors
When number is infinite, not a number, larger than LONG_MAX or smaller
than LONG_MIN, print a corresponding error and return STATUS_CMD_ERROR.

This should fix the worst of the problems, by at least making them clear.

Fixes #4479.
Fixes #4768.
2018-03-07 18:03:44 +01:00
Fabian Homborg
98d29b53de Refresh winsize before printing prompt
This allows prompts to react to $COLUMNS by e.g. omitting some parts.

We still fallback to a ">" prompt if that's still not short enough,
but now the user has a way of making a nicer prompt.

Fixes #904.
Fixes #4381.
2018-03-07 17:46:48 +01:00
Mahmoud Al-Qudsi
b50541c655 Add comment about checking if jq exists in a future update to yarn completions 2018-03-06 17:03:15 -06:00
Fabian Homborg
88cf7e16c6 [git completions] Sort tags newest-first
This has the nice effect of sorting "2.7.0" before "2.7b1".
2018-03-06 22:06:39 +01:00
Fabian Homborg
5cb3918c1c [git completions] Remove unnecessary helper function 2018-03-06 22:06:39 +01:00
Fabian Homborg
f3c864a9e2 [git completions] Offer unmerged files for add
These occur e.g. when resolving a conflict, which then needs `git add`.
2018-03-06 22:06:39 +01:00
Fabian Homborg
b24971dc9e [git completions] Only offer files for log --
After a "--" separator, `git log` only takes files.
2018-03-06 22:06:39 +01:00
Fabian Homborg
754b52bb26 [git completions] Make branches work on git 2.7.0 again
This used the "--format" option, which was only added in git 2.13.0.
2018-03-06 22:06:39 +01:00
Cesar Andreu
3792fb086a Fix man autocomplete when a section is set 2018-03-06 20:50:20 +01:00
Mahmoud Al-Qudsi
4414d5c888 Block custom/user completions for all invalid heads
If the head is not a valid, existent command, do not load and run custom
completion sources. This applies to both the autosuggestion provider and
manual user completions. File-based completions will still be offered.

Supersedes #4782 and #4783. Closes #4783. Closes #4782. Closes #2365.
2018-03-06 12:52:42 -06:00
Mahmoud Al-Qudsi
3c895c2839 Add whitespace helpers to complete.h/cpp 2018-03-06 12:52:42 -06:00
Fabian Homborg
93209ab053 Fix termux path
This is "/data/data/com.termux/files/usr/etc", not just ".../files/etc".
2018-03-06 17:55:25 +01:00
Fabian Homborg
e7f8e58be9 Add more ssh known_hosts paths
Fixes #4759.
2018-03-06 15:27:34 +01:00
ridiculousfish
3b2de931cd Simplify tokenize_variable_array() 2018-03-05 22:05:05 -08:00