Commit Graph

12660 Commits

Author SHA1 Message Date
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
Johannes Altmanninger
971c2eb668 history search: do not move the cursor after failing backward search
When editing a multiline command line and pressing "up" with the cursor at the
first line, fish attempts a hsitory search. If the search fails, don't move
the cursor to the end of the multiline command because this can be annoying
when the user does not actually want to perform a history search.
2020-07-01 00:40:32 +02:00
Johannes Altmanninger
8b961a0ca8 Bind undo to Control-Z in addition to Control-/
See #7152
2020-07-01 00:40:32 +02:00
Johannes Altmanninger
4f796df87c Clarify comment 2020-07-01 00:40:32 +02:00
Daniel Bengtsson
2da806cceb Remove useless import in webconfig file.
The random and string module was imported but not used.
2020-07-01 00:40:01 +02:00
Gokul Soumya
3f210acdff
Add completions for yadm (#7100) 2020-07-01 00:34:00 +02:00
Jeff Cook
b27440d536 Fix paste-o that duplicated documentation header. 2020-06-30 23:45:41 +02:00
Mahmoud Al-Qudsi
9846328b41 [xinput] Provide completions for device properties
Also support specifying devices and properties by name, not just id.

[ci skip]
2020-06-29 22:09:53 -05:00
Mahmoud Al-Qudsi
614c494859 Speed up default ^C action considerably
No more shelling out to external commands, no more loops, and no
conditionals past the initial check.
2020-06-29 19:41:33 -05:00
Aadi Bajpai
7c5b19ec2c
Change natural number to non-negative integer (#7161)
* natural → whole

* positive whole

* positive whole number → non-negative integer
2020-06-29 20:26:53 +02:00
Mahmoud Al-Qudsi
1c743356d7
Merge pull request #7153 from mqudsi/fast_waccess
Speed up executable command completions
2020-06-29 13:17:17 -05:00
Mahmoud Al-Qudsi
46587b47c4 Add completions for synclient
[ci skip]
2020-06-29 13:03:48 -05:00
Daniel Bengtsson
05abd0ed68 Fix long description in completion.
Simplify the description sudo for the option l. I think it's sufficient.

Fixes: #6981
2020-06-29 09:58:02 -05:00
Mahmoud Al-Qudsi
0b55f08de2 Speed up executable command completions
This brings down the number of syscalls per potential completion result
from three or four to just one.
2020-06-29 09:27:49 -05:00
Mahmoud Al-Qudsi
48b59cc194 Fix detection of executables with 007 mode
It's not surprising that this never came up, as I cannot imagine a more
useless chmod value. Perhaps in the context of nologin or something?
*shrug*
2020-06-28 23:06:44 -05:00
Mahmoud Al-Qudsi
da21ab5892 [xinput completions] Support devices with : in name
[ci skip]
2020-06-28 23:03:03 -05:00
exploide
a966ace4a9 __fish_print_hostnames: match IPv6 addresses + cleanup 2020-06-28 20:11:39 -05:00
Mahmoud Al-Qudsi
f5b431c21b Remove std::move blocking potential copy elision 2020-06-28 18:08:13 -05:00
Fabian Homborg
5c22be518b fish_config: Start webbrowser in background thread
Current firefox-developer-edition (i.e. the beta) blocks here.

This is awful and bad, but we can easily work around it by just using
a thread.

Blergh

Fixes #7158
2020-06-28 16:42:05 +02:00
Mahmoud Al-Qudsi
0414be75cc fixup! set_color: Don't error with "-b" and no argument 2020-06-26 19:46:23 -05:00
Clément Martinez
5da3a95451 Add git diff --staged completion 2020-06-26 18:26:50 -05:00
Daniel Bengtsson
e2f03fa8a7 Add a function to check if the user is root.
Add a helper function to check if the user is root. This function can be
useful for the prompts for example. Modify the prompts made root checked
to use the function instead. Add also the support of Administrator like
a root user.

Fixes: #7031
2020-06-26 21:25:13 +02:00
Hugo Gualandi
de9e8cb897 Fix binfmts.h typo in a comment
The name of the header file is binfmts.h, with an "s" at the end.
2020-06-26 21:00:25 +02:00
Fabian Homborg
86a6a205e7 set_color: Don't error with "-b" and no argument
We already don't print an error with just `set_color`, so it should be
consistent.

Fixes #7154

(also removes an impossible exit)
2020-06-26 20:59:17 +02:00
Mahmoud Al-Qudsi
f0580b4970 [tests] Fix test to reflect whitespace changes to error message 2020-06-25 23:19:44 -05:00
Mahmoud Al-Qudsi
4ba9e70f9a Remove extraneous line break in the middle of an error message 2020-06-25 23:01:59 -05:00
Mahmoud Al-Qudsi
34b918d0a0 Reduce unneeded calls to tcgetpgrp
After profiling bottlenecks in job execution, the calls to `tcgetpgrp`
were identified to take a good amount of the execution time. Collecting
metrics on which branches were taken revealed that in all "normal"
cases, there is no benefit to calling `tcgetpgrp` before calling
`tcsetpgrp` as it can instead be called only in the error case to
determine what sort of error handling behavior should be applied.

This makes the best-case scenario of a single syscall much more likely
than in the previous situation.
2020-06-25 22:46:09 -05:00
Mahmoud Al-Qudsi
d0afae46ce [tests] Do not rely on env output to be sorted alphabetically 2020-06-25 21:41:06 -05:00
Mahmoud Al-Qudsi
c3849ebeba Convert var_table_t to an unordered_map
Profiling revealed string comparison in variable lookups to be a
significant hotspot. This change causes `make test` to complete ~4.5%
faster per `hyperfine`.
2020-06-25 00:56:49 -05:00
Mahmoud Al-Qudsi
a5be15da69 Optimize lookup of electric variables 2020-06-24 22:46:02 -05:00
Mahmoud Al-Qudsi
9bddd78239 fixup! Eliminate recursive calculation of string length in wildcard matching
This was originally comparing two pointers for equality but after the
refactor to wcstring it ended up comparing a const string pointer to the
_contents_ of the wcstring.
2020-06-24 21:53:05 -05:00