Commit Graph

12596 Commits

Author SHA1 Message Date
David Adam
ebdaa1df4d Switch Travis to Ubuntu Bionic (18.04) 2020-07-16 22:11:21 +08:00
ridiculousfish
352062219d More clean up of parse_util_detect_errors_in_argument 2020-07-14 15:51:12 -07:00
ridiculousfish
3532a955a6 Use parse_util_locate_cmdsubst_range when validating arguments
Removes another usage of parse_util_locate_cmdsubst().
2020-07-14 15:34:26 -07:00
ridiculousfish
68d256a91c Use parse_util_locate_cmdsubst_range in highlighting 2020-07-14 15:27:14 -07:00
ridiculousfish
9cade52c77 Clean up expand_cmdsubst somewhat
Eliminate some of the pointer arithmetic and switch to
parse_util_locate_cmdsubst_range. It's still a pretty ugly function.
2020-07-14 15:19:10 -07:00
Fabian Homborg
276c76a363 Test alias with a --option
Closes #4756.
2020-07-14 21:08:47 +02:00
Fabian Homborg
9256f37e9e Add test for redirection to variable
Closes #6443
2020-07-14 20:55:38 +02:00
blinry
b178f0921e Rephrase confusing display of key binding in documentation
The binding Alt+., followed by a full stop, wasn't ideal. Rephrase the sentence to avoid that.
2020-07-14 20:29:14 +02:00
blinry
641f1b00e4 Fix link target for "other features"
Seems the link targets need a blank line above them, otherwise they will be rendered into the document.
2020-07-14 20:28:45 +02:00
Fabian Homborg
42486a4cb3 Don't do CWD OSC in tests
Should fix #7193.
2020-07-13 20:55:39 +02:00
Fabian Homborg
fec3a593a2 test.fish: Erase more environment variables
Unfortunately this doesn't quite fix the issue with Pantheon
Terminal (#7913), as that somehow manages to re-set $VTE_VERSION by
the time littlecheck runs.
2020-07-13 20:55:39 +02:00
ridiculousfish
37dc554fe1 Revert "Remove unnecessary owning_lock usages"
This reverts commit 3a5585df95.

This reverts a change that removed a lock. It's indeed true that in master,
fish script is bound to the main thread. But I'm working to remove that
limitation and these locks are important in that future.
2020-07-12 18:56:39 -07:00
ridiculousfish
4904e4bc41 Fix autosuggestion validation
When switching to the new ast, commands that were not decorated
statements (like function declarations) would be rejected from
autosuggestion validation because we could not find a command. Stop
rejecting them.
2020-07-12 18:47:33 -07:00
Mahmoud Al-Qudsi
3a5585df95 Remove unnecessary owning_lock usages
The owning locks were added after the original code and decorated with
comments indicating they are thread-safe, even though they're only ever
used from the main thread. Presuming the intent was to make future
manipulation of the code safer rather than to actually make use of any
thread safety guarantees, these have been wrapped in a new
`thread_exclusive` type which always calls ASSERT_IS_MAIN_THREAD.

The benefit is that this does not perform a syscall to lock a mutex
each time the variables are accessed.
2020-07-12 20:21:28 -05:00
Mahmoud Al-Qudsi
9f8e4ab524 Don't load vendor extensions when running unit tests
a) they can screw up our expected output/behavior
b) they can blow up your system

In my case, the unit tests were calling Pantheon's fish integration
script which would then proceed to blow up dbus with messages about each
individual test completing.
2020-07-12 19:14:35 -05:00
Mahmoud Al-Qudsi
6d45dd837f Remove trailing ", " in functions output
When executed interactively and not piped, `functions` adds a comma as a
separator between each result. This removes the separator after the last
item.
2020-07-12 19:14:35 -05:00
Mahmoud Al-Qudsi
f1951fed3a Fix suggestionOK variable name 2020-07-12 19:14:35 -05:00
Mahmoud Al-Qudsi
73bf9dd784 Stop calling path_get_path for builtins and functions
highlight.cpp was blindly calling path_get_path for each head command
typed at the prompt which triggers a lot of syscalls via waccess.

It's still going to do that while commands are being composed, but now
it won't if we can make a cheap lookup to the builtins/functions hash
table and can determine that it's a valid command before inspecting the
filesystem.
2020-07-12 19:14:35 -05:00
ridiculousfish
3319e308d0 Make ast::node_t non-virtual
Eliminate its vtable to save 8 bytes per node, which is a lot!
2020-07-12 16:57:30 -07:00
ridiculousfish
a8eb2a6813 Make union_ptr_t's constructor statically type safe
Ensure it cannot be constructed from the wrong node type.
2020-07-12 16:57:30 -07:00
ridiculousfish
8d37be2916 ast lists to use new[] instead of vector
Because the list is not changed after construction, we do not need
the vector's capacity field. This reduces the size of lists from 48
to 32 bytes.
2020-07-12 16:57:30 -07:00
ridiculousfish
c12ab7a674 Rearrange ast::node_t fields to improve packing 2020-07-12 16:57:30 -07:00
ridiculousfish
487de1e6c3 Reduce copying in parse_util_detect_errors
Allow parse_util_detect_errors to accept an already-parsed ast. This
eliminates a copy of the source, which is helpful when executing large
scripts.
2020-07-12 16:57:30 -07:00
ridiculousfish
dfeec433d8 Reduce allocation churn in parse_util_detect_errors
Reuse a single string for storage.
2020-07-12 16:57:30 -07:00
Mahmoud Al-Qudsi
af157dea67 Preserve CMake options when make is invoked 2020-07-12 18:26:12 -05:00
ridiculousfish
9ee5075fc3 Reformat CPP files 2020-07-12 12:21:25 -07:00
Mahmoud Al-Qudsi
f1a59e83c5 Move __fish_set_lscolors to ls.fish
It's not used anywhere else.

[ci skip]
2020-07-12 14:18:42 -05:00
ridiculousfish
2a4c545b21 Rework how signals trigger cancellation
When fish receives a "cancellation inducing" signal (SIGINT in particular)
it has to unwind execution - for example while loops or whatever else that
is executing. There are two ways this may come about:

1. The fish process received the signal
2. A child process received the signal

An example of the second case is:

    some_command | some_function

Here `some_command` is the tty owner and so will receive control-C, but
then fish has to cancel function execution.

Prior to this change, these were handled uniformly: both would just set a
cancellation signal inside the parser. However in the future we will have
multiple parsers and it may not be obvious which one to set the flag in.
So instead distinguish these cases: if a process receives SIGINT we mark
the signal in its job group, and if fish receives it we set a global
variable.
2020-07-12 12:16:01 -07:00
ridiculousfish
12d0afa929 Fix some build warnings in fish_tests 2020-07-12 11:41:06 -07:00
ridiculousfish
2e5222ffe8 Finish renaming job tree to job group
Some "tree" terminology was still there.
2020-07-11 17:05:42 -07:00
ridiculousfish
765c48afa4 Migrate the notion of 'foreground' from job to job group
Whether a job is foreground is a property of its pgid, so it belongs
naturally on the job group.
2020-07-11 17:01:52 -07:00
Gokul Soumya
0c72e65071 Update changelog regarding _whatis_current_token binding 2020-07-12 00:15:25 +02:00
Gokul Soumya
ec0c3f349d Return early if token is empty in whatis_current_token 2020-07-12 00:15:24 +02:00
Gokul Soumya
5f782cef7d Show builtin description with whatis_current_token 2020-07-12 00:13:51 +02:00
Gokul Soumya
e665f9b523 Precedence for functions over commands in whatis_current_token 2020-07-12 00:11:37 +02:00
Gokul Soumya
d0ce5fe943 Show function description if available with whatis_current_token
By default __fish_whatis_current_token is bound to ALt-W
2020-07-12 00:11:37 +02:00
Johannes Altmanninger
1f8c9a5d42 __fish_print_help: handle [ and : 2020-07-12 00:11:37 +02:00
Charles Gould
c2fe319af0 fish_config: 'Webify' color definitions
The colors defined in `colorutils.js` are specified in
fish format, and therefore RGB values lack the leading
`#` character and do not fully follow the html/css spec
(w3.org/TR/css-color-4/#typedef-hex-color).

Web config sends these values as-is to the browser,
without first converting to a browser-friendly format.
While this (somehow) works for the most part, a few
colors get lost along the way and do not display in
the customization selector nor in the preview when
selected. This behavior was seen in Firefox.

To fix this, let's prepend the missing '#' character
to all RGB colors defined in `colorutils.js`.
2020-07-11 13:51:52 -07:00
Johannes Altmanninger
2083acec2e
Merge pull request #7187 from MaxVerevkin/master
create_manpage_completions.py: introduce TypeScdocManParser; refactor
2020-07-11 18:08:51 +02:00
MaxVerevkin
aff2e76021 create_manpage_completions.py: introduce TypeScdocManParser which is capable of parsing scdoc manpages
This greatly improves generated completions for scdoc man pages, see #7187.
2020-07-11 17:39:36 +02:00
MaxVerevkin
d3661b3808 create_manpage_completions.py: add .SH and .UN sections in Type2ManParser
This improves some generated completions, for example:

	diff -u completions.old/g3topbm.fish completions.new/g3topbm.fish
	+complete -c g3topbm -o stop_error -d 'This option tells g3topbm to fail when it finds a problem in the input'
	-complete -c g3topbm -o stop_error
2020-07-11 17:36:07 +02:00
MaxVerevkin
23c78a74e4 create_manpage_completions.py: do not use '|' in '[]' in regex 2020-07-11 15:52:16 +02:00
MaxVerevkin
4f867ce513 create_manpage_completions.py: refactor 2020-07-11 15:52:16 +02:00
MaxVerevkin
d1ad143cf1 create_manpage_completions.py: refactor: clean up parse_manpage_at_path 2020-07-11 15:52:16 +02:00
MaxVerevkin
75f93a590e create_manpage_completions.py: refactor: clean up parse_and_output_man_pages 2020-07-11 15:52:16 +02:00
MaxVerevkin
0d863378ea create_manpage_completions.py: refactor: remove unnecessary 'skip' 2020-07-11 15:52:16 +02:00
Johannes Altmanninger
0c9e651fdf create_manpage_completions.py: use correct capture group 2020-07-11 15:46:33 +02:00
ridiculousfish
225470493b Make parse_token_type_t an enum class
Improves type safety.
2020-07-09 14:22:04 -07:00
Fabian Homborg
a40c82dcc4 Check if create_manpage_completions was installed
Fixes #7183.
2020-07-09 18:35:41 +02:00
Fabian Homborg
8a6a265c3e docs: Add word splitting example 2020-07-09 18:35:41 +02:00