Commit Graph

8381 Commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
c51abd04ff Clean up $__fish_*dir variable names
Closes #4429
2018-03-12 08:34:20 -05:00
Mahmoud Al-Qudsi
b42b562d06 Revert prompt_hostname to short hostname only
Hat-tip: @zx8. Closes #4804.
2018-03-12 08:24:42 -05:00
Mahmoud Al-Qudsi
2cdacbdce4 Restore sanity to line continuations
Line continuations (i.e. escaped new lines) now make sense again. With
the smart pipe support (pipes continue on to next line) recently added,
this hack to have continuations ignore comments makes no sense.

This is valid code:

```fish
echo hello |
# comment here
tr -d 'l'
```

this isn't:
```fish
echo hello | \
# comment here
tr -d 'l'
```

Reverts @snnw's 318daaffb2
Closes #2928. Closes #2929.
2018-03-12 08:12:23 -05:00
Mahmoud Al-Qudsi
0b96b516d5 Improve and expand is_whitespace helper functions 2018-03-12 08:06:50 -05:00
Mahmoud Al-Qudsi
2951fadc6b Fix parameter expansion tests on Travis macOS 2018-03-12 07:50:37 -05:00
Giovanni Bajo
3b7d759d11 Update completions for go
The tool subcommand had a "-f" flag to disallow file completions which is wrong: most of the tools there require a file/directory argument.

Since we're here, also limit "go tool compile" to only match Go source files.
2018-03-12 20:34:35 +08:00
Mahmoud Al-Qudsi
857a89e4bd fixup! Fix oob memory access in expand's call to trim() 2018-03-12 07:31:28 -05:00
Mahmoud Al-Qudsi
ee069baf42 Fix oob memory access in expand's call to trim() 2018-03-12 07:22:27 -05:00
Mahmoud Al-Qudsi
4e48b084d7 Remove duplicate trim() call in parameter expansion 2018-03-12 07:20:50 -05:00
Mahmoud Al-Qudsi
d385248cc8 Merge branch 'fix_brace_parsing'
Closes #3802 and improves tokenizer handling of invalid expressions
involving braces, parentheses, and brackets.
2018-03-12 07:05:47 -05:00
Mahmoud Al-Qudsi
1e5d7d98a8 Add tests for new parameter expansion features 2018-03-12 07:04:05 -05:00
Mahmoud Al-Qudsi
24afff1c77 Handle whitespace within parameter expansion tokens
From the discussion in #3802, handling spaces within braces more
gracefully. Leading and trailing whitespace that isn't quoted or escaped
is stripped, whitespace in the middle is preserved. Any whitespace
encountered within expansion tokens is treated as a single space,
similar to how programming languages that don't hard break tokens/quotes
on line endings would.
2018-03-11 22:02:43 -05:00
Mahmoud Al-Qudsi
364115f818 fixup! Properly parse spaces and escaped/quoted spaces in expansion braces 2018-03-11 20:18:21 -05:00
Mahmoud Al-Qudsi
0620cdf711 Fix tokenizer errors for nested, alternating {} and () 2018-03-11 20:18:03 -05:00
Mahmoud Al-Qudsi
1629d339de Properly parse spaces and escaped/quoted spaces in expansion braces 2018-03-11 19:51:54 -05:00
Mahmoud Al-Qudsi
00f95a978e Make { and } valid, first-class tokenizer elements 2018-03-11 19:36:10 -05:00
Mahmoud Al-Qudsi
7447432471 Fix tests for new ) token error 2018-03-11 17:16:53 -05:00
Mahmoud Al-Qudsi
df89d71237 Correct escaping behavior in new tokenizer code 2018-03-11 17:10:16 -05:00
Mahmoud Al-Qudsi
f508a1f274 Reset tokenizer state on start and improve slice error detection 2018-03-11 12:13:55 -05:00
Mahmoud Al-Qudsi
d367d57ae9 Merge commit '8a7104a0a477f367614583afefd2fcd0dd06e506' (Remove $_)
Replaces $_ with $current_cmd. Closes #813.
$_ does not appear to be used anywhere in our codebase.
2018-03-10 22:35:26 -06:00
Mahmoud Al-Qudsi
8a7104a0a4 Rename $_/$fish_title to $current_cmd 2018-03-10 21:33:16 -06:00
Mahmoud Al-Qudsi
9ca89fce6a Remove $_ and replace with $fish_title
Not sure about the new name. We've been using $version unprefixed and
now we also have $pid and $last_pid. $title is very generic.
2018-03-10 20:41:47 -06:00
Mahmoud Al-Qudsi
fb1c7a3d68 Simplify token parser 2018-03-10 18:42:56 -06:00
Mahmoud Al-Qudsi
65a03c86cb Rename BRACKET in reference to { to BRACE instead per #3802
This `{` is a curly brace. This `[` is a square bracket.
2018-03-10 13:16:53 -06:00
Mahmoud Al-Qudsi
c98ed6d07a Rename BRACKET to BRACE per #3802 2018-03-10 13:16:07 -06:00
Mahmoud Al-Qudsi
2e5c531ff1 Add test and run rules to BSDmakefile 2018-03-10 11:44:45 -06:00
Mahmoud Al-Qudsi
7bfcccf701 Use correct, platform-agnostic invocation of cmake in BSDmakefile
cmake can (and should) be used to invoke the build/install command,
instead of directly calling `ninja` or `make`, via the `--build DIR
[--target TARGET]` syntax.
2018-03-10 11:44:45 -06:00
Mahmoud Al-Qudsi
fbed821a5b Switch BSDmakefile to invoke build via cmake
This will use the native BSD bmake build system instead of the previous
hack which spawned an instance of `gmake` (GNU Make) if installed to
perform the build.
2018-03-10 11:44:45 -06:00
Mahmoud Al-Qudsi
ef728d3c1d Update .gitignore (sort entries, add /tags) 2018-03-10 11:44:45 -06:00
Daniel Apolinario
cc80951e79 Completions for bb-wrapper and powerpill
Completions for bb-wrapper (bauerbill) and powerpill
2018-03-10 18:31:29 +01:00
George Christou
4ae6843b6b completions: [git] Fix rogue bracket typo (#4799) 2018-03-10 18:30:43 +01:00
Mahmoud Al-Qudsi
18a9aa58cd Add binding for MSFT/WSL paste escape sequence 2018-03-10 10:57:32 -06:00
Mahmoud Al-Qudsi
b3ec069401 Add missing $argv injection in fish_default_key_bindings.fish
These have to be present in all the default rules so that any errors can
be silenced at startup (and so additional arguments can be passed in).
2018-03-10 10:54:29 -06:00
Mahmoud Al-Qudsi
4ca31ae987 [cmake] Correct bad MSVC rule in PCRE CMakeLists.txt file 2018-03-10 10:47:06 -06:00
Mahmoud Al-Qudsi
315439bacc Address minor documentation issue
Closes #3458
2018-03-10 07:26:40 -06:00
Mahmoud Al-Qudsi
e6e6c0b625 Update **nix -> *nix (Markdown escaping issue) in readme 2018-03-10 07:20:14 -06:00
ridiculousfish
9a5afe3913 Clean up and document functions --handlers 2018-03-10 02:27:25 -08:00
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