Commit Graph

12540 Commits

Author SHA1 Message Date
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
Fabian Homborg
4981115f73 webconfig: Fix "then" arguments
This used to use "success", which was our own thing, but which I can't
get working.

So instead we just use ".then", which only passes one object as an
argument that then contains all the other data we use.

This should be enough to complete the port to angular 1.8
2020-07-06 20:10:01 +02:00
Fabian Homborg
3f904b6a59 webconfig: Replace unsafe binding with filter
ng-bind-html-unsafe was apparently removed.
2020-07-06 20:10:01 +02:00
Fabian Homborg
9cfcdfa105 WIP Update angular to something from after the stoneage 2020-07-06 20:10:01 +02:00
David Adam
4a35248465 docs/bind: make list formatting consistent 2020-07-06 20:50:19 +08:00
David Adam
1b121bd9a6 docs/jobs: add example output and remove spurious header 2020-07-06 20:48:13 +08:00
Mahmoud Al-Qudsi
02d0380e6b Make fish_exit workaround for forced exit not SIGHUP-specific 2020-07-05 23:17:21 -05:00
Mahmoud Al-Qudsi
04c6442dcc Allow fish_exit to run even on fish SIGHUP
We were previously aborting the main event loop before calling fish_exit
in the event of a SIGHUP. This patch causes the SIGHUP to be stored in a
separate state variable from a regular "must exit" condition so the
associated event can be fired before we terminate the loop.

All streams are redirected before the event is called to prevent a
SIGTTIN/SIGTTOU due to the user script reading/writing from a disposed
tty.

Closes #7014
2020-07-05 22:18:21 -05:00
Mahmoud Al-Qudsi
791c4fb1dd Fix unused return value errors in fish tests
This error only happens on recent versions of gcc, see previous
commit e6bb7fc973 for more info.

Instead of using `ignore_result()` here, I've added a `system_assert`
function/macro that mimics the behavior of all the other `system()`
calls in the file.
2020-07-05 22:18:21 -05:00
Shun Sakai
d24a14744c
Update apk-tools completions (#7171)
* Update apk-tools completions

Add completions of options of it's subcommands.
The completions of deprecated options is unimplemented.

* Fix installed package listing for apk-tools

An error occurs when the local cache does not exist, so fixed this.
2020-07-05 18:22:36 -05:00
ridiculousfish
bd4c4a9a9c Stop weak linking pre 10.9 macOS symbols
Previously fish weak-linked wcsdup, wcsncasecmp, and wcscasecmp.
This enabled fish to be used on 10.6. However the minimum Mac version
is now 10.9, where these symbols are available.
2020-07-05 12:49:29 -07:00
ridiculousfish
6976d0ee7e Simplify infinite loop fix when parsing "a="
This reworks the "a=" detection to be simpler.
If we detect a variable assignment that produces an error,
simply consume it.

We also take the opportunity to not highlight it as an error,
and add some tests.

Original commit is 1ca05d32d3.
2020-07-05 12:15:18 -07:00
ridiculousfish
23224f71ce Make some variables local which did not need to be static 2020-07-05 12:15:18 -07:00
Mahmoud Al-Qudsi
fb4967945a fixup! Put -Wno-redundant-move behind a compiler check
Use -Werror in the CMake test because the compiler check passes even
if warnings are emitted.
2020-07-05 13:31:28 -05:00
Johannes Altmanninger
1ca05d32d3 Fix infinite loop when parsing "a="
Typing that command in an interactive prompt would make the highlighter thread
eat up CPU and memory.  Probably not the right fix; I think the token should
already have been consumed when the error is detected, then there is no need
to consume it when unwinding.
2020-07-05 13:19:48 +02:00
Johannes Altmanninger
ada03d3509 Correct pager size when command line soft-wraps
When selectiong a large completion entry in the pager, it would clobber the
prompt. To reproduce, first run this command

	complete -c : -xa '(
		# completion entries that,  when applied to the commandline
		# need one, two, or three lines respectively
		echo 1
		echo 2(string repeat -n (math $COLUMNS - 5) x)
		echo 3(string repeat -n $COLUMNS x)
		printf %s\n n(seq $LINES)
	)'

then type ": " and hit Tab repeatedly. When cycling through completion
entries, observe that fish always tries to render the pager with the same
size, even though the number of lines occupied by the command line buffer
changes due to soft wrapping.

Fix this by rendering the pager after the command line has been rendered, so
we know how many lines we have left.
2020-07-05 08:55:17 +02:00
Johannes Altmanninger
826db22dbf Adjust deprecated stderr redirection in fish_xgettext.fish 2020-07-05 08:55:11 +02:00
Mahmoud Al-Qudsi
fe2da0a94f Put -Wno-redundant-move behind a compiler check
This fixes a warning under Ubuntu 18.04's default gcc
(cc++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0)
2020-07-04 21:14:43 -05:00
Mahmoud Al-Qudsi
e628ba51e7 Remove repeated calculation of fixed string's length in a loop 2020-07-04 20:38:06 -05:00
Mahmoud Al-Qudsi
b8a16a8ba0 Convert highlighted_char_t to a struct 2020-07-04 20:23:50 -05:00
ridiculousfish
44944146e2 Merge branch 'parser_cleanup_3'
This merges a sequence of changes which eliminates the "parse tree"
construct and replaces it with a new abstract syntax tree implementation.
This is simpler and easier to understand/use.
2020-07-04 15:06:41 -07:00
ridiculousfish
0c22f67bde Remove the old parser bits
Now that everything has been migrated to the new AST, remove as much of
the parse_tree bits as possible
2020-07-04 14:58:05 -07:00
ridiculousfish
3534c07584 Adopt the new AST in parse_execution
parse_execution is what turns a parsed tree into jobs, etc. Switch it from
parse_tree to the new AST.
2020-07-04 14:58:05 -07:00
ridiculousfish
6c6088f45c Adopt the new AST in fish_tests
This switches fish_tests from parse_tree to the new AST.
2020-07-04 14:58:05 -07:00
ridiculousfish
886603b2ca Adopt the new AST in fish_indent
This switches fish_indent from parsing with parse_tree
to the new ast.

This is the most difficult transition because the new ast retains less
lexical information than the old parse tree. The strategy is:

1. Use parse_util_compute_indents to compute indenting for each token.

2. Compute the "gap text" between the text of significant tokens. This
contains whitespace, comments, etc.

3. "Fix up" the gap text while leaving the significant tokens alone.
2020-07-04 14:58:05 -07:00
ridiculousfish
6b24edccf6 Adopt the new AST in add_pending_with_file_detection
This switches add_pending_with_file_detection from parsing with parse_tree
to the new ast.
2020-07-04 14:58:05 -07:00
ridiculousfish
202fdfa54a Adopt the new AST in parse_util_detect_errors
This switches parse_util_detect_errors from parsing with parse_tree to
the new ast.
2020-07-04 14:58:05 -07:00
ridiculousfish
7bea5ffa2e Adopt the new AST in parse_util_compute_indents
This switches parse_util_compute_indents from parsing with parse_tree to
the new ast.

It also reworks the parse_util_compute_indents tests, because
parse_util_compute_indents will be the backing for fish_indent.
2020-07-04 14:58:05 -07:00
ridiculousfish
358d7072a2 Adopt the new AST in bash history import
This switches bash history importing from parsing with parse_tree to the
new ast.
2020-07-04 14:58:05 -07:00
ridiculousfish
46c4ec8d68 Adopt the new AST in completion argument lists
This switches completion argument list expansion from parsing with
parse_tree to the new ast.
2020-07-04 14:58:05 -07:00
ridiculousfish
0d4f9c6220 Adopt the new AST in abbreviation expansion
This switches abbreviation expansion from parsing with parse_tree to the
new ast.
2020-07-04 14:58:05 -07:00
ridiculousfish
8d9725c301 Adopt the new AST in highlighting
This switches syntax highlighting from parsing with parse_tree to the new
ast.
2020-07-04 14:58:05 -07:00
ridiculousfish
4d4455007d Introduce a new fish ast
This is the first commit of a series intended to replace the existing
"parse tree" machinery. It adds a new abstract syntax tree and uses a more
normal recursive descent parser.

Initially there are no users of the new ast. The following commits will
replace parse_tree -> ast for all usages.
2020-07-04 14:58:02 -07:00
ridiculousfish
45c9e3b0f1 parsed_source_ref to always make a job_list
Removed an unnecessary param in preparation for more changes.
2020-07-04 14:51:15 -07:00
ridiculousfish
e530163078 Revert "fix unreachable code warning"
This reverts commit 202fe39d34.

If mkostemp is a weak symbol and is null, then the code will
be reachable.
2020-07-04 14:49:05 -07:00
Mahmoud Al-Qudsi
79d6710db4 fixup! Add udevadm completions
[ci skip]
2020-07-04 15:49:47 -05:00
Gokul Soumya
7e2a067f53
Add completions for mpc (#7169) 2020-07-04 19:46:19 +02:00
Gokul Soumya
6212a584a7 docs/jobs: Header is stripped in command substitution 2020-07-04 13:25:17 +02:00
ridiculousfish
90d8df8128 Use _POSIX_VDISABLE instead of \0 to disable control functions
Prior to this commit, fish used NUL ('\0') to disable control
functions (for example, the function that generates SIGTSTP).
However NUL may in fact be bindable and is on macOS via
control-space.

Use instead _POSIX_VDISABLE if defined and not -1.
2020-07-01 22:33:31 -07:00
Fabian Homborg
77f412af1b fixup! Also clear suggestions
Also #7145.
2020-07-01 21:00:16 +02:00
Fabian Homborg
eb35975c0f Make cancel-commandline actual bind function
This was always awkward as fish script, and had problems with
interrupting the autoloading.

Note that we still leave the old function intact to facilitate easier
upgrading for now.

Fixes #7145.
2020-07-01 20:56:56 +02:00
Mahmoud Al-Qudsi
de47a096e8 Add udevadm completions
[ci skip]
2020-07-01 09:27:20 -05:00
Johannes Altmanninger
ca188fef8c webconfig: fix regex 2020-07-01 00:44:06 +02:00
Johannes Altmanninger
76e0875c8f Apply clang-format 10 and selected lints from "make lint-all" 2020-07-01 00:44:06 +02:00
Johannes Altmanninger
25fe353187 Readline command beginning-of-history visits the oldest search match
Previously it would do the same as end-of-history
2020-07-01 00:40:32 +02:00
Johannes Altmanninger
e5b8035fea Fix updating command line on Page-Down
Page-Down seems to deactivate history search, so trying to undo
would leave the command line in an inconsistent state.

Fixes #7162 which was introduced in
12a9cb29 Fix assertion failure on page up / page down
2020-07-01 00:40:32 +02:00
Johannes Altmanninger
2b3b460264 Make reader_history_search_t::matches a vector instead of a deque
It is used exclusively as vector at the moment since we only ever append
at the end.  Making it a deque would be useful when allowing to edit the
search string and subsequently resume the search at an arbitrary position
in the history.
2020-07-01 00:40:32 +02:00