Commit Graph

12487 Commits

Author SHA1 Message Date
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
Mahmoud Al-Qudsi
bfa17ecff6 Fix call site for wildcard_match_internal 2020-06-24 21:23:18 -05:00
Mahmoud Al-Qudsi
a6f1e6119b Eliminate recursive calculation of string length in wildcard matching 2020-06-24 17:21:18 -05:00
Fabian Homborg
149a0b98af Another formatting run
I really kinda hate how insistent clang-format is to have line
breaks *IFF THE LINE IS TOO LONG*.

Like... lemme just add a break if it looks better, will you?

But it is the style at this time, so we shall tie an onion to our
belt.
2020-06-24 20:43:56 +02:00
Fabian Homborg
c21a3b9d71 Break up lines over 1000 characters
Yeah, these are just excessive.

In case you are wondering: 2812 characters was the longest line in all
of fish.
2020-06-24 20:42:03 +02:00
Gokul Soumya
e41404eed3
Improve git config completions (#7150)
* completions/git: Show all accepted values with git config

Finally closes #3812.

Acceptable values are generated using `git help --config`

* completions/git: Show config value as description for git config

* completions/git: Handle multiline config values

When completing `git config` only display the first
line of config value as description if it is
multiline, appended with an ellipsis.
2020-06-24 20:07:25 +02:00
Malobre
94f4473d3b
Fix #7113, correct a few regexes. (#7130)
* Fix #7113 (cannot call help using msys2), correct a few regexes.

* Use regex instead of glob-style matching

* Match `\.exe$` instead of `cmd\.exe$` for WSL

* Match `\.exe(\s+|$)` instead of `\.exe$` and `cmd\.exe$`

* Fix a few regexes

This allows cygstart to be manually set as a browser, with or without arguments
2020-06-24 18:36:37 +02:00
Gokul Soumya
2fd78fd5c2
Uncomment most recent comment if commandline is empty when using toggle comment binding (#7137)
* functions/__fish_toggle_comment_commandline: Uncomment most recent comment if commandline is empty

* Refactor variable setting in functions/__fish_toggle_comment_commandline.fish

* Update changelog regarding toggle comment binding
2020-06-24 18:35:36 +02:00
Fabian Homborg
d0c1f2a2cc Remove duplicated line
Oops.
2020-06-24 18:33:26 +02:00
Fabian Homborg
3d2dc856ab Disable the SUSP character
This makes binding \cz possible.

We already ignore the SIGTSTP signal it sends, so until now it was useless.

(also STOP and START for good measure, but since we disable flow
control in fish anyway these already shouldn't have been sent)

Fixes #7152
2020-06-24 18:26:17 +02:00
Fabian Homborg
9ae880f6ac Comment *why* adb needs its redirections hand-fed
[ci skip]
2020-06-23 09:02:26 +02:00
Erutuon
2b6ce30a70 Fix redirection in adb shell
`adb` shell by default sends stderr from the command to stdout, so that `adb pull nonexistent<tab>` will show the error message from the `find` command. `>` must be escaped so that redirection is done inside the command executed by `adb shell`.
2020-06-23 08:59:02 +02:00
Mahmoud Al-Qudsi
8b910d6de2 Further optimize performance of terminal output
Profiling shows that parsing color names still took much longer than it
should.

wcscasecmp is so slow that using it directly causes `try_parse_special`
to consume up to 3% of all of fish's cpu time due to extremely
inefficient invariant case lookups for wide characters (tested: Fedora
Server 32 w/ glibc 2.31 with -O2).
2020-06-22 23:39:51 -05:00
Gokul
c7a8e35bfc completions/function: Update missing completions
- Complete signals with --on-signal
- Complete variables with --on-variable and --inherit-variable
- Complete event handlers with --on-event
- Complete commands with --wraps
- Add `complete` spec for --inherit-variable
2020-06-22 17:27:57 +02:00
Clément Martinez
1d1a2802ca Add completion for systemctl --failed 2020-06-22 17:24:15 +02:00
Mahmoud Al-Qudsi
3c90b6c57d Re-implement optimizations to color lookup by name
Hopefully without the null-termination issues this time around. Fixed by simply
cloning the str object as-is then transforming it.
2020-06-20 17:00:30 -05:00
Fabian Homborg
7447c8faae Also undo changes to ICRNL and INLCR
These control the disambiguation between ctrl-j and ctrl-m.

This can cause the enter key to send a ctrl-m, which programs might be
unprepared for.

(This is why you need to do `stty sane<ctrl-j>`)
2020-06-20 23:40:37 +02:00
Fabian Homborg
30eb4d8b0d Revert "Optimize lookup of colors by name"
Yeah, there's some weirdness here with ASAN that I can't reproduce locally, so we revert it for now.

This reverts commit a6efe0f0e4.
2020-06-20 22:35:14 +02:00
Fabian Homborg
40de4ef764 Color lookup: Use wcsncmp to avoid looking at garbage
The `reserve` here can, under certain circumstances, reserve more than
strictly needed.

The simple workaround is to just never look at more than we feed in.

(really what we'd *want* is to look at the length of the *color
names*, but those are wchar, so length lookup is crappy NULL-lookup)
2020-06-20 22:13:54 +02:00
Fabian Homborg
63f7f1925e git prompt: Simplify "staged" logic
This had this weird "pass along the sha, then check" logic to it which
is entirely unnecessary.

This function just says when something is staged, nothing more. Why
that is you can figure out for yourself.

This makes it easier to call this function, and it no longer prints an
empty line if nothing is staged.
2020-06-20 21:47:19 +02:00
Mahmoud Al-Qudsi
a6efe0f0e4 Optimize lookup of colors by name
This was profiled to be a hotspot during startup. The usage of
wcscasecmp in a loop caused repeated transforms to lowercase, which is
incredibly slow for wide characters.
2020-06-20 13:57:24 -05:00
Fabian Homborg
d8e5dfbb51 completions/dnf: Only offer the packagename
Removing the extraneous cruft.

Really, this should just be using its database properly.

Fixes #7118.
2020-06-20 19:56:33 +02:00
Fabian Homborg
197d615cc8 git prompt: Minor cleanup 2020-06-20 19:01:27 +02:00
Fabian Homborg
4186d840db git prompt: Simplify some helper functions 2020-06-20 19:01:27 +02:00