Commit graph

12723 commits

Author SHA1 Message Date
ridiculousfish
68275e7f58 Simplify parser_keywords_is_reserved 2020-08-08 15:04:52 -07:00
Johannes Altmanninger
93cb0e2abb __fish_complete_suffix: enable fuzzy completion, simplify
fish's internal completion logic is much smarter than the globbing in this
function, so let's just reuse "complete -C", and filter directories and
files with the given suffix.

Thanks to @Kratacoa for reporting on Gitter.

Using "complete -C" works well no prefix is given. Since in this repository
only the openocd completions pass a prefix, I left the prefix-case as is.
It could probably be improved and simplified as well.  The prefix argument was
introduced to avoid cd's side effects inside a completion. Using cd is tempting
though because it would allow to use the same logic as without a prefix.
2020-08-08 22:59:41 +02:00
Johannes Altmanninger
0dd334ee46 __fish_complete_suffix: replace prefix only at start 2020-08-08 22:56:54 +02:00
Johannes Altmanninger
b7bd7e9916 Clean up some __fish_complete_suffix usage
Also don't cd in pine completions.
2020-08-08 22:56:54 +02:00
Fabian Homborg
2cdd6df257 fish_indent: Add a "--check" option to only test indentation
Fixes #7251.
2020-08-08 20:23:14 +02:00
Fabian Homborg
b4f5ba6537 tests: Exit: Try sleeping multiple times 2020-08-08 16:35:08 +02:00
Fabian Homborg
7c0ecf0d37 Increase job summary timeout more in one call 2020-08-08 16:35:08 +02:00
Fabian Homborg
46faf0869c tests: Stop sleeping before expect
It's useless - `expect` has a timeout anyway, and it defaults to 5s,
so these 0.5s sleeps just mean it'll always take at least 0.5s.

Sometimes it is useful to let things settle before *sending* text, and
it would be nice to be able to set the timeout for each expect
separately, but just adding to the timeout isn't useful.
2020-08-08 16:35:08 +02:00
Fabian Homborg
2c1148e3b5 CHANGELOG: Some formatting fixes 2020-08-08 16:35:08 +02:00
Fabian Homborg
7de333f839 tests: jobs: Sleep more
This one sometimes fails with a zombie detected, so I'm assuming it's
too fast for reaping to happen, so we add another 100ms sleep.

Yeah, this isn't great but...eh
2020-08-08 16:35:08 +02:00
Fabian Homborg
05ddbb1d2e tests: Add an additional "sleep"
This sometimes fails on Travis because sending things to the
background can take a while
2020-08-08 16:35:08 +02:00
Fabian Homborg
103a4ece81 Add parens to silence warning
This triggered -Wparentheses in gcc 10.1.0
2020-08-08 09:14:47 +02:00
ridiculousfish
3dcb39f8ec Improve codegen of generation_list_t::operator==
Bizarrely comparing three integers showed up heavy in traces. This
reduces the time in seq_echo by about 500 msec.
2020-08-07 23:15:09 -07:00
ridiculousfish
5bee1e3e1f Avoid an errant copy in autoload_t::resolve_command
The ternary expression was causing the list of paths (e.g.
$fish_function_path) to be copied. Avoid that copy with an if statement.

This reduces the time spent in try_autoload from 2.4 sec to 961ms on
the seq_echo benchmark run 1024 times, about 5% improvement.

Oh, C++...
2020-08-07 22:34:42 -07:00
ridiculousfish
2cd336376e Refactor process_mark_finished_children
Reduce the level of nesting and the loop complexity.
2020-08-07 12:34:53 -07:00
Fabian Homborg
203061292f Remove unused "__fish_prompt_cwd" variable
The repaint handler erased a variable that was just a dumb cache when `set_color` wasn't a builtin.

It was removed in 3f11d90744 in 2014.
2020-08-07 21:06:16 +02:00
Fabian Homborg
616cd38d8e docs: Don't use force-repaint
It's not needed here and misleading. force-repaint isn't all that
useful and especially not something for a simple example.
2020-08-07 21:06:16 +02:00
Fabian Homborg
677e699a7a Stop repainting after paste
"repaint" here is a bit of a misnomer. It *doesn't* re-highlight, that
just happens on its own.

It re-runs the prompt, which can take quite a while (depending on the
configuration), and which is also useless in this context as this
isn't something the prompt will be reacting to (theoretically it
could, but I doubt the utility of displaying "PASTE" for a few milliseconds).
2020-08-07 21:06:16 +02:00
Fabian Homborg
f63d70298f tests: Use ps -o stat instead of "state"
Oh, Alpine
2020-08-07 21:06:16 +02:00
Fabian Homborg
911f043bf0 CHANGELOG Typo 2020-08-07 21:06:16 +02:00
Fabian Homborg
0b4ea71b8b CHANGELOG Moar examples 2020-08-07 21:06:16 +02:00
Fabian Homborg
fea3a92e40 CHANGELOG fish_add_path some more
We should do more of this, the changelog doesn't have to be as short
as possible.
2020-08-07 21:06:16 +02:00
Fabian Homborg
be9d17b08a help: Add the other pages 2020-08-07 21:06:16 +02:00
ridiculousfish
26fda2bf0d Improve some formatting in proc.h 2020-08-07 11:38:47 -07:00
Carlos Alexandro Becker
ef8c397e7b docs: fix small formatting issues 2020-08-07 22:05:05 +08:00
ridiculousfish
557fe57deb Close the file descriptor returned by mkstemp 2020-08-06 19:12:15 -07:00
ridiculousfish
206b2d0a26 Simplify topic monitoring
The topic monitor allows a client to wait for multiple events, e.g. sigchld
or an internal process exit. Prior to this change a client had to specify
the list of generations and the list of topics they are interested in.
Simplify this to just the list of generations, with a max-value generation
meaning the topic is not interesting.

Also remove the use of enum_set and enum_array, it was too complex for what
it offered.
2020-08-06 19:01:30 -07:00
Johannes Altmanninger
f7ef91ae2a Use mkstemp over mktemp to silence warning 2020-08-06 21:24:26 +02:00
Johannes Altmanninger
d7ccc475cf Cleanup __fish_complete_subcommand
The external-commands-only completion was briefly added in 3.1.0 and removed
in 3.1.1 (see #6798), which means we can remove some dead code.

Maybe we should just remove __fish_complete_external_command - it could break
users, but then again, we don't really have a way to stop people from starting
to use this deprecated function. The underscores ought to communicate that
this is function is private to fish but that is not enforced.
2020-08-06 21:24:26 +02:00
Johannes Altmanninger
b947e360db Allow newlines after && and ||
We do the same for pipes (#1285). This matches POSIX sh behavior.
2020-08-06 21:24:26 +02:00
ridiculousfish
e6616d7017 Correct a misspeeling 2020-08-06 11:51:08 -07:00
Soumya
916ffe8273 Only bold status in default prompt when set by last command
Uses regular text when the status is carried over, e.g. after a background job.
2020-08-05 12:23:49 -07:00
Soumya
539e6fe8b1 Return no status from successful variable assignments 2020-08-05 12:23:49 -07:00
Soumya
8dd2d4f15d Change builtins to return maybe_t<int> instead of int 2020-08-05 12:23:49 -07:00
Soumya
56c64281bd Update -latomic check to match the one in LLVM.
It's not entirely clear why the existing check does not work, but it seems to pass on clang++ even without -latomic, but causes the fish build to fail later.

Confirmed that with this change, g++ does not use -latomic, while clang++ does, and fish builds fine with both.
2020-08-05 12:23:49 -07:00
Soumya
a2b2bcef6e Add a $status_generation variable that's incremented for each interactive command that produces a status.
This can be used to determine whether the previous command produced a real status, or just carried over the status from the command before it. Backgrounded commands and variable assignments will not increment status_generation, all other commands will.
2020-08-05 12:23:49 -07:00
Allen Sobot
54823c9243
Implement XBPS completions (#7239) 2020-08-05 20:01:19 +02:00
Johannes Altmanninger
8d3b66fb52 Reflow comment 2020-08-04 21:44:59 +02:00
Johannes Altmanninger
64601fd4d3 Reformat CPP files 2020-08-04 21:44:59 +02:00
Johannes Altmanninger
4f6ad69c8a Changelog entry for 25fe353 Page Up to go to oldest search match 2020-08-04 21:44:26 +02:00
Johannes Altmanninger
242b60fdef history.rst: clarify that "history search" is the default command 2020-08-04 21:44:26 +02:00
ridiculousfish
81f9f51bcb Incorporate widecharwidth changes for narrow emoji
This pulls in widechar_width.h from commit 7e9dfdaf05059b3f. The big change
here is that some characters which were previously marked as widened in 9
are now marked as unconditionally narrow; this includes some randoms like
hot pepper (U+1F336) but more importantly all of the regional indicators,
which affects how flags are rendered.

If you put two regional indicators together, you get a flag emoji. It's
unclear what the width of this flag emoji should be; Terminal and iTerm2
renders it as width 1, while kitty renders it as width 2. This is
unaffected by fish_emoji_width because the flag does not have an assigned
codepoint, it is a pair of codepoints.

The regional indicators are marked as "neutral" in EastAsianWidth.txt which
means they conceptually have width 1. So two of them have width 2. So now
we assume that flags are rendered as width 2.

This fixes #7237, for terminals that render flags as width 2 (but not 1,
unfortunately, which includes iTerm2 and Terminal.app).
2020-08-04 12:40:46 -07:00
ridiculousfish
c9bcb52fe9 Pull in later widecharwidth
This pulls in widechar_width.h from commit d4e75d5bb1930291223d1.
This is a "rebuild with latest data" before we attempt a risky bugfix.
The idea here is that bisecting can separate whether any regression is
due to using the latest Unicode data, or the bug fix.
2020-08-04 12:21:33 -07:00
ridiculousfish
fc5067ca33 Fix an uninitialized variable warning on gcc 6 2020-08-04 11:01:31 -07:00
ridiculousfish
976ed6d2e8 Fix std::hash overload on g++ 6
Fixes a build error introduced in 6eab9275d0.
2020-08-04 10:56:14 -07:00
ridiculousfish
6eab9275d0 Cache resolved colors when outputting to the screen
Prior to this change, fish would "resolve" highlight specs to rgb colors
right before use. This requires a series of variable lookups; profiling
showed 30% of draw time was spent here.

Switch to caching these (within a single redraw only).
2020-08-03 17:34:27 -07:00
ridiculousfish
87d049edd8 Remove redirect_tty_output call from tcgetattr return
tcgetattr cannot return EIO.
2020-08-03 16:42:27 -07:00
ridiculousfish
f1402ac7a3 Eliminate some uses of current_data in the reader 2020-08-03 15:41:12 -07:00
ridiculousfish
272ca37582 Remove most dynamic reader configuration
Have the reader accept a constant configuration object, which controls
whether autosuggestions, etc. are enabled. These things don't change
dynamically.
2020-08-03 15:02:44 -07:00
ridiculousfish
fadd429348 Make the shell test function a toggle
We either perform fish syntax checking or we don't; there's no reason
to specify a function pointer here.
2020-08-03 14:31:09 -07:00