Commit Graph

12768 Commits

Author SHA1 Message Date
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
Fabian Homborg
73c0fa03b8 git prompt: Also repaint correctly if use_informative_chars is set 2020-06-20 19:01:27 +02:00
Oscar Tin Lai
eb4f86710d
Add support for git-* command auto-completion (#7075)
* add support for git custom command completion

* small fixups

* remove autogenerated path from sourcing git-* completions
2020-06-20 18:35:10 +02:00
wayou
424e658d16 Add completions for deno 2020-06-20 18:31:57 +02:00
Mahmoud Al-Qudsi
f2d5f95396 Merge sigint_checker_t generalizations from #7060
This makes it possible to expand the signals checked by the type. I can't merge
the sigttin fixes for #7060 yet because they introduce new breakage, but this
will make merging any future fix easier.
2020-06-20 11:27:15 -05:00
Daniel Bengtsson
dd1a26588a Fix long description in completion.
Simplify the description, I think it's sufficient like this.

Fixes: #6981
2020-06-20 18:18:45 +02:00
Daniel Bengtsson
b8d0de1b88 Typo.
Replace the tabulation by space.
2020-06-20 18:17:11 +02:00
Fabian Homborg
ee0d13a552 completions/set: Stop "hiding" dunder-prefixed variables
This was intended to stop showing the user "unimportant" variables,
but it just didn't complete them entirely, even if the current token
starts with a dunder (or `fish` of all things!).

Because completions sort `_` last, let's just complete these always
and let the user filter them.
2020-06-20 09:51:29 +02:00
Fabian Homborg
894ec3dfd4 fish_git_prompt: Always allow for displaying stashstate
This wasn't added to the prompt status order, so it was computed and
then not used for the informative prompt.

We still check later if we should compute it, so this is harmless if
showstashstate is unset.

Fixes #7136.
2020-06-20 09:33:04 +02:00
Fabian Homborg
92b987145e Disable macos tests on github again
Yeah, just *much* too slow to not be super flaky.
2020-06-19 23:13:21 +02:00
Fabian Homborg
c5f06cde82 docs/string: Fix match examples
One was just cosmetic (too many \\), one was actually broken because
it had duplicated `{{`, possibly resulting from the doxygen conversion?

[ci skip]
2020-06-19 21:23:51 +02:00
Fabian Homborg
e9e23a8333 Force some terminal modes even for external commands
In #7133, neovim crashing caused "OPOST" to be turned off, which
caused a weird staircase display.

So we just force a set of settings that don't seem useful to change to
avoid breaking the terminal with something like that.

Fixes #7133.
2020-06-19 21:09:08 +02:00
Fabian Homborg
56a9e698d0 Github Actions: Work around macos codesigning
We can't use gettext and we won't use system pcre2.
2020-06-18 17:27:07 +02:00
Fabian Homborg
89622eb6f3 Github actions: Try macos again
This might possibly use pexpect
2020-06-18 17:20:27 +02:00
Fabian Homborg
298073f08c github: Use pexpect 2020-06-18 17:10:09 +02:00
Fabian Homborg
de981aafb7 travis: Remove expect 2020-06-18 17:08:10 +02:00
Fabian Homborg
a121833e88 argparse: Only print stacktrace when it's an error in argparse usage
A broken/missing optspec or `--` is a bug in the script using
argparse, an unknown option or invalid argument is a bug in using that script.

So in the former case print a stacktrace, because the person writing
the `argparse` call is at fault, in the latter don't.

Fixes #6703.
2020-06-17 20:05:48 +02:00
Fabian Homborg
4660be372a Only disable title in emacs "term"
There's more than one emacs terminal (for some reason), and term is
the most broken one and can't even handle a title.

Fixes #7122.
2020-06-17 16:48:13 +02:00
Fabian Homborg
00f7cdae62 tests: Don't send \cA
Breaks the tests in screen.

Fixes #7111.
2020-06-17 15:55:31 +02:00
Fabian Homborg
547f649797 docs: Slight reword of argparse's optional argument section
[ci skip]
2020-06-17 15:36:50 +02:00