Commit Graph

13014 Commits

Author SHA1 Message Date
jonbakke
02d0e50b61 Fix typo (verb clarification) in math.rst
Was: "parameter expansion takes before expressions are evaluated."
Now: "parameter expansion happens before expressions are evaluated."

I suspect the original intent was to use "takes place," but I see "happens" as less idiomatic and therefore may benefit non-English-native users.
2020-08-19 12:18:52 -07:00
Fabian Homborg
0e8761bc70 CHANGELOG fish_indent --check
[ci skip]
2020-08-17 18:04:14 +02:00
Johannes Altmanninger
eb59d4eb14 Run fish_indent on share/**.fish 2020-08-17 17:40:28 +02:00
Johannes Altmanninger
19943576e4 fish_indent: preserve semis in if and while conditions
It could be nice to use a heuristic for this in future, but for now let's
stick to the old behavior so we can keep formatting scripts without occasional
bad formatting changes.

A heuristic could also be used to break lines after |, && or || but I don't
think there is much need for that at the moment.

Closes #7252
2020-08-17 17:40:28 +02:00
ridiculousfish
d50c0c2b85 Prevent certain 100% CPU loops
We weren't correctly updating the internal exit generation value. This
meant that if one internal process exits, every other internal process
that has not exited will continually check, leading to 100% CPU usage.

I think this mainly affects concurrent mode, but it may be reproducible
if you have a command which refuses to consume its input.
2020-08-16 12:56:42 -07:00
ridiculousfish
b0182183d4 Rework exit command
Prior to this fix, the `exit` command would set a global variable in the
reader, which parse_execution would check. However in concurrent mode you
may have multiple scripts being sourced at once, and 'exit' should only
apply to the current script.

Switch to using a variable in the parser's libdata instead.
2020-08-15 16:06:54 -07:00
ridiculousfish
a83dbec075 Remove reader_bg_job_warning
It was unused.
2020-08-14 16:29:42 -07:00
ridiculousfish
82fed6fc2f Correctly propagate signals from cancelled jobs into parse_execution_context
This concerns code like the following:

    while true ; sleep 100; end

Here 'while' is a "simple block execution" and does not create a new job,
or get a pgid. Each 'sleep' however is an external command execution, and
is treated as a distinct job. (bash is the same way). So `while` and
`sleep` are always in different job groups.

The problem comes about if 'sleep' is cancelled through SIGINT or SIGQUIT.
Prior to 2a4c545b21, if *any* process got a SIGINT or SIGQUIT, then fish
would mark a global "stop executing" variable. This obviously prevents
background execution of fish functions.

In 2a4c545b21, this was changed so only the job's group gets marked as
cancelled. However in the case of one job group spawning another, we
weren't propagating the signal.

This adds a signal to parse_execution_context which the parser checks after
execution. It's not ideal since now we have three different places where
signals can be recorded. However it fixes this regression which is too
important to leave unfixed for long.

Fixes #7259
2020-08-13 15:30:15 -07:00
ridiculousfish
1cf835e6e9 switch statements to respect fish_trace
Previously switch statements were not reported by fish_trace.
2020-08-13 14:36:48 -07:00
David Adam
70f51937d9 complete.cpp: correct a comment
[ci skip]
2020-08-13 16:03:15 +08:00
ridiculousfish
d3f8445bcb Fix the job_summary pexpect test on Mac
Macs don't have a CPU column in jobs.
2020-08-12 16:40:32 -07:00
Colin Woodbury
a0b46e6204 Update Aura completions 2020-08-13 00:29:55 +02:00
Fabian Homborg
c46489bde8 tests/job_summary: Add jobs call
Might help figuring out where this times out on CI?

We're waiting *20 seconds* for the output to appear, there's no way
that's too slow. So maybe we're going too fast elsewhere?
2020-08-12 18:38:15 +02:00
Fabian Homborg
1c6953ce79 tests/signals: Add missing sys import
This was only used if it failed for sys.exit(1)
2020-08-12 18:38:15 +02:00
ridiculousfish
57102caba6 Remove the cursor position from highlighting
This used to be used to determine which token contained the cursor, so
as to highlight potential paths. But now we highlight all potential paths,
so we can remove the field.
2020-08-11 17:42:30 -07:00
ridiculousfish
84b9cc5c01 Factor reader's selection range into a new struct
The selection is used in vi visual mode. Previously it was four fields
embedded in the reader. Switch to a new struct wrapped in a maybe.
2020-08-11 14:29:52 -07:00
ridiculousfish
5c38c4f531 Stop caching indentation in the reader
In practice we didn't use the cache for anything. Always compute it on
demand.

This eliminates the 'indents' variable which had to be manually kept in
sync with the command line.
2020-08-11 13:41:19 -07:00
ridiculousfish
a6b8394114 Remove some debugging code which was accidentally left in 2020-08-11 13:11:48 -07:00
ridiculousfish
65f7f90433 Correctly highlight =s in var assignments after the first
We were not correctly offsetting the = in the token, it was always from the
start of the string.
2020-08-11 12:27:32 -07:00
ridiculousfish
703e6f571e Highlight the = in variable assignments as an operator 2020-08-10 16:41:56 -07:00
Fabian Homborg
7254dfecb2 fish_indent: Print the failed files with --check
Also return the number of failed files.

I decided to *just* print the filenames (newline-separated because
NULLs are annoying here) to make it easier to deal with.

See #7251.
2020-08-10 22:03:51 +02:00
Fabian Homborg
a7305c7082 tests: Increase timeout for signals test 2020-08-10 22:03:51 +02:00
ridiculousfish
8301aa9929 Add a test that nohup works
If fish is invoked with nohup, then its children should be nohup too.
2020-08-10 12:26:30 -07:00
Johannes Altmanninger
46a69d6b90 Simplify prime-run completions 2020-08-10 20:46:07 +02:00
oriko1010
8b02a78887 Add completion for prime-run 2020-08-10 20:44:20 +02:00
David Adam
d8eb7fc46d fish: support -o short option correctly
Closes #7254.
2020-08-10 13:37:29 +08:00
ridiculousfish
aaa59d377e Remove a bunch of #ifdef'd out code 2020-08-09 15:06:50 -07:00
ridiculousfish
c1abb474c2 Remove some dead code and enable a test 2020-08-09 15:05:16 -07:00
Johannes Altmanninger
563a2d824c fish_indent: indent comments before line continuation
See #7252
2020-08-09 23:59:30 +02:00
Johannes Altmanninger
f8f32628a6 fish_indent: no extra newline at comment after pipe
Fixes the unstable case in #7252
2020-08-09 23:59:30 +02:00
Johannes Altmanninger
14a66fad64 Use variable in tests/checks/indent.fish 2020-08-09 23:53:46 +02:00
Johannes Altmanninger
9c327b19a6 Fix extra or missing newlines at end of file in our fish scripts
New fish_indent does that too, so this will make any future reformatting
diffs smaller.

Done using either of:

	perl -pi -e 'undef $/; s/\n*$/\n/' share/**.fish
	kak -n -f '<a-/>\n*<ret>d' share/**.fish
2020-08-09 23:53:46 +02:00
Johannes Altmanninger
918c62863e Fix typo 2020-08-09 23:53:46 +02:00
Johannes Altmanninger
908620e2ab Correct list formatting in CONTRIBUTING.rst 2020-08-09 23:53:46 +02:00
Dave Nicolson
2fc1e755c7 Fix typo 2020-08-09 12:29:35 -07:00
ridiculousfish
f6c1ef58df Indent continuations after | and &&
This indents continuations after pipes and conjunctions if they contain
a newline.

Example:

    cmd1 &&
        cmd2

But it avoids the "double indent" if it indented unconditionally:

    cmd1 | begin
        cmd2
    end

More work towards improving #7252
2020-08-09 12:22:15 -07:00
ridiculousfish
9a53bf7d56 fish_indent: indent line continuations
For example:

    cmd \
        arg

Fixes one case from #7252
2020-08-09 12:22:14 -07:00
ridiculousfish
e2a26b2fdf fish_indent: Correct certain comment indenting
Prior to this change, when emitting gap text (comments, newlines, etc),
fish_indent would use the indentation of the text at the end of the gap.
But this has the wrong result for this case:

    begin
    command
    # comment
    end

as the comment would get the indent of the 'end'. Instead use the indent
computed for the gap text itself.

Addresses one case of #7252.
2020-08-09 12:22:05 -07:00
David Adam
86b02278b6 CHANGELOG: work on 3.2.0 2020-08-09 15:05:55 +08:00
ridiculousfish
2676926902 Use unordered_map instead of map in lru
They have the same iterator invalidation guarantees, and unordered_map
benchmarks as faster for wcstring.
2020-08-08 15:32:06 -07:00
ridiculousfish
91955c1371 Don't eagerly fetch the current time in autoloading
The call to now() is not always necessary and shows up in traces.
2020-08-08 15:30:04 -07:00
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