Commit graph

12736 commits

Author SHA1 Message Date
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
ridiculousfish
7ea396ab3f Remove lrand48 checks and support
lrand48 is no longer used.
2020-07-08 11:00:12 -07:00
Mahmoud Al-Qudsi
50e2a8dd72 [dnf] Fall back to dnf repolist when no sqlite3
[ci skip]
2020-07-08 11:24:29 -05:00
Mahmoud Al-Qudsi
4a5f0f3a3d Fix missing references when manually linking against curses
When CMake's own curses logic fails to find curses/ncurses, we fall back to
pkg-config and manually link the required libraries. Some platforms (RHEL 6,
see #6587) require CURSES_EXTRA_LIBRARY=tinfo, so we link against libtinfo
if it's found but are happy to continue without it if it doesn't exist.

Closes #6587
2020-07-08 10:58:41 -05:00
ridiculousfish
35cb449aa1 Make parse_statement_decoration_t a class enum 2020-07-07 16:28:39 -07:00
ridiculousfish
71a8eb0aa4 parsed_source_t to hold an ast directly instead of through unique_ptr
We have untangled the dependency loop and so now parsed_source_t no longer
requires indirection.
2020-07-07 16:16:45 -07:00
ridiculousfish
5308223212 Migrate next_parse_token into token_stream_t
Cleaning up parse_tree.cpp with an eye to remove it.
2020-07-07 14:01:01 -07:00
ridiculousfish
72e35af381 Remove preceding_escaped_nl
It's no longer necessary for fish_indent
2020-07-07 13:48:35 -07:00
Mahmoud Al-Qudsi
8d25ed962c Add early abortion of completion match attempt 2020-07-06 23:08:19 -05:00
Fabian Homborg
0b3b4f3d91 Add code of conduct
This adopts the Contributor Covenant Code of Conduct 2.0

We don't currently have an email address for enforcement, once that's set up we can
add it in.

[ci skip]
2020-07-06 20:13:01 +02:00
Fabian Homborg
213ac15caa Remove duplicate color
This was always wrong, but the new(er) angular actually complains
about it.
2020-07-06 20:10:01 +02:00