Commit graph

11541 commits

Author SHA1 Message Date
Fabian Homborg
0fab1ce8b4 Port locale test to littlecheck 2020-02-08 09:38:23 +01:00
Fabian Homborg
f8af262af7 Port some smaller tests to littlecheck 2020-02-08 09:31:49 +01:00
Fabian Homborg
eaf84c553d Port line-continuation test to littlecheck 2020-02-08 09:31:49 +01:00
Johannes Altmanninger
12a9cb2940 Fix assertion failure on page up / page down
I had overlooked {beginning,end}-of-history which don't search.
2020-02-08 08:55:02 +01:00
Fabian Homborg
e40441f901 Port history tests to littlecheck 2020-02-07 20:53:20 +01:00
Fabian Homborg
15d2797ec1 Port pipestatus test to littlecheck 2020-02-07 20:49:42 +01:00
Fabian Homborg
fc884e9cf4 Port function.in test to littlecheck 2020-02-07 20:41:01 +01:00
Fabian Homborg
921fce3a51 math: Complain about unknown *function*, not *variable*
We removed variables from tinyexpr, so we shouldn't use that error.
2020-02-07 17:43:22 +01:00
Johannes Altmanninger
8a033b9f3d Add undo
Add the input function undo which is bound to `\c_` (control + / on
some terminals). Redoing the most recent chain of undos is supported,
redo is bound to `\e/` for now.

Closes #1367.
This approach should not have the issues discussed in #5897.

Every single modification to the commandline can be undone individually,
except for adjacent single-character inserts, which are coalesced,
so they can be reverted with a single undo. Coalescing is not done for
space characters, so each word can be undone separately.

When moving between history search entries, only the current history
search entry is reachable via the undo history. This allows to go back
to the original search string with a single undo, or by pressing the
escape key.
Similarly, when moving between pager entries, only the most recent
selection in the pager can be undone.
2020-02-07 17:15:17 +01:00
Geoff Nixon
f7edfba5d7 Avoid apropos on macOS 10.15 with man completion
Same issue occurs here, as in #6270 (and fixed in 611a658 for `__fish_describe_command.fish`). Same reason. I've just copied the same workaround and changed the function name to match.
2020-02-07 20:52:39 +08:00
David Adam
43edbf4a91 config.fish: drop PATH modifications on Solaris-derived systems
Fixes #6556.

Although present since 2006, fish no longer relies on POSIX-compliant tools to the same degree. This
code causes a platform specific change that makes the tests fail, so remove it.
2020-02-07 20:43:15 +08:00
ridiculousfish
3f6884e5a1 Use move semantics in expand_braces
Reduces copying during expansion.
2020-02-06 13:02:28 -08:00
Johannes Altmanninger
440b791b38 Add changelog headers for fish next-minor and add an entry for #6566 2020-02-06 15:48:25 +01:00
David Adam
21f2628c06 fish.spec: group conditionals to correctly detect Fedora
Fixes test failures due to glibc-langpack-en not being installed.
2020-02-06 13:15:49 +08:00
David Adam
5a8685b26c debian packaging: bump Python requirement to 3.5+
Work on #6537.
2020-02-06 12:46:00 +08:00
Jason Nader
fb00d6638e completions/apt: Add support for filename completions
Plus some small fixes.
Fixes #6209
[ci skip]
2020-02-06 02:17:38 +01:00
Johannes Altmanninger
5d135d5556 prompts: fix pipestatus for jobs prefixed with "not"
6902459566 was an attempt to not print
$status twice in the prompt. As a result we print $pipestatus but
not $status, which /usually/ is the same as $pipestatus[-1] --- unless
the builtin "not" is used, which inverts the $status of a job (it does
not alter $pipestatus).

As a result, the default prompt prints unexpected status codes:

	~ > not false
	~ [1]> not true
	~ > not true | true
	~ > not false | false
	~ [1|1]>

This commit reintroduces printing of $status after $pipestatus, but only
if it is different from $pipestatus[-1].
Additionally, we only print anything at all if the $status is nonzero,
to avoid confusing output on `not false | false`

	~ > not false
	~ > not true
	~ [0] 1> not true | true
	~ [0|0] 1> not false | false
	~ >

I think this is closer to users' expectations for those cases; they should
not have to think about this implementation detail of the not-statement.
2020-02-06 01:43:17 +01:00
Johannes Altmanninger
14c6a12782 Use accessor functions for editable_line_t::{text,position}
This is paving the way for undo, where we want to have one central place
for modifying an editable_line_t.
2020-02-06 01:30:45 +01:00
ridiculousfish
a765026c4c Adopt fd_monitor in bufferfill
This switches bufferfills from using an exclusively-owned thread, to
sharing an fd_monitor. This allows multiple bufferfills to all use the same
thread.
2020-02-05 12:05:39 -08:00
ridiculousfish
057c3a9e75 Introduce fd_monitor
fd_monitor is a new class which can monitor a set of fds, waiting for them
to become readable. When an fd becomes readable, a callback is invoked.
Timeouts are also supported.

This is intended to replace the "bufferfill" threads. Rather than one
thread per bufferfill, we will have a single fd_monitor which can service
multiple bufferfills. This helps today with nested command substitutions,
and will help in the future with concurrent execution.
2020-02-05 12:04:51 -08:00
Mahmoud Al-Qudsi
9bf5dfd738 Further enrich cargo completions
* Replace multiple calls to `tail` and `string` with a single `string
  replace` execution
* Dynamically generate list of available benches, bins, and tests for
  `--bench`, `--bin`, and `--test` switches

[ci skip]
2020-02-04 18:12:02 -06:00
ridiculousfish
bd06a9aa6c Retain leading spaces in non-expanding braces
This makes two changes:

1. Remove the 'brace_text_start' idea. The idea of 'brace_text_start' was
to prevent emitting `BRACE_SPACE` at the beginning or end of an item. But
we later strip these off anyways, so there is no apparent benefit. If we
are not doing brace expansion, this prevented emitting whitespace at the
beginning or end of an item, leading to #6564.

2. When performing brace expansion, only stomp the space character with
`BRACE_SPACE`; do not stomp newlines and tabs. This is because the fix in
came from a newline or tab literal, then we would have effectively
replaced a newline or tab with a space, so this is important for #6564 as
well. Moreover, it is not easy to place a literal newline or tab inside a
brace expansion, and users who do probably do not mean for it to be
stripped, so I believe this is a good change in general.

Fixes #6564
2020-02-04 11:49:12 -08:00
Mahmoud Al-Qudsi
8f4797a38b Update cargo completions to use dynamic --example options
[ci skip]
2020-02-03 13:48:11 -06:00
Jason Nader
c6f85238b9 docs: Reword description for -D 2020-02-02 18:10:04 -08:00
ridiculousfish
1101cff566 Factor out some of the crazy logic in reader_interactive_init 2020-01-31 11:11:03 -08:00
ridiculousfish
8d8bcb7d8a Stop acquiring the terminal before running builtins
fish has some unprincipled code that attempts to tcsetpgrp() to own the
terminal before running a builtin; this was added because 'read' might
want to read from the terminal. I added this code before fully
understanding how process groups and terminals work. A better fix would
be to ensure that fish is marked as the pgroup leader in the job when
the builtin is the first process in the job, and we do that now.

Courageously back out the changes to grab the terminal; see #5147 and
also #5133.
2020-01-31 10:42:21 -08:00
Jason Nader
ce61c745a5 Remove explicit .html links
See commit 1711636
2020-01-31 23:21:43 +08:00
Jason Nader
bc3b64bb50 Fix broken links to index.html in cmd docs 2020-01-31 23:12:05 +08:00
Michael Sanders
3f8907d7cf Add pyenv completions 2020-01-30 21:53:45 -08:00
Michael Sanders
5c8ef19ff8 Bring rbenv completions up-to-date 2020-01-30 21:53:14 -08:00
ridiculousfish
73106198c8 Update to latest widecharwidth
Fixes a Cygwin incompatibility. Fixes #6549
2020-01-30 21:17:37 -08:00
ridiculousfish
2c4e15e267 Fix the Cygwin build for uvar notifiers 2020-01-30 20:44:29 -08:00
ridiculousfish
97c456a986 Improve support for job control in non-interactive scenarios
Avoid complaining about ENOTTY results from tcsetpgrp, and ensure we
ignore SIGTTOU the first time job control is enabled.
2020-01-30 15:18:10 -08:00
Fabian Homborg
9735a18add Always return a value, even in unreachable code
To placate dumb compilers, we sometimes have to include code that will
never be executed.

Should fix the build when -Werror=return-type is in effect.
2020-01-30 20:39:42 +01:00
ridiculousfish
70195164d4 Refactor child_set_group 2020-01-30 11:27:21 -08:00
ridiculousfish
a243e65939 Rename pgroup_mode to pgroup_provenance 2020-01-30 11:14:31 -08:00
ridiculousfish
aaaca9773a Unconditionally call set_child_group() after posix_spawn
Previously we did this conditionally only if GLIBC is defined, but
it looks harmless to do this unconditionally. Let's do it.
2020-01-30 11:07:28 -08:00
ridiculousfish
10da6df506 Factor out logic about how pgroups are assigned
Introduce pgroup_provenance_t, a type which captures "where the pgroup
comes from." This centralizes some logic around how pgroups are
assigned, and it anticipates concurrent execution.
2020-01-30 10:50:16 -08:00
ridiculousfish
d22c6af7a3 clang-format all C++ files 2020-01-30 10:50:11 -08:00
Fabian Homborg
e8000cfea9 Add Solaris' error message to a test
Just another version of the error. We still want to get a bug if it
ever triggers a *wrong* error, so we still list all the options
instead of going for `.*option:.*Z.*`.

Fixes #6554
2020-01-30 18:07:03 +01:00
Fabian Homborg
9cbd3d57a0 Tests: Don't remove a parent of $PWD
Solaris/OpenIndiana/Illumos `rm` checks that and errors out.

In these cases we don't actually need it to be a part of $PWD as
it's just for cleanup, so we `cd` out before.

See #5472
See 1ee57e9244
Fixes #6555
Fixes #6558
2020-01-30 17:34:48 +01:00
Fabian Homborg
cc7d9cc2ed flog: Save & restore errno
In some cases on some platforms this could clobber errno, so doing something like

    aThingThatFailsWithErrno();
    FLOG(category, "Some message");
    wperror("something");

would print the wrong error (presumably if that category was enabled).

In our case it was our (very) old friend RHEL6 returning ESPIPE instead of EISDIR.

Fixes #6545.
2020-01-30 17:31:30 +01:00
Johannes Altmanninger
50e08dc3a0 add completions for wireshark/tshark/dumpcap 2020-01-30 16:45:02 +01:00
Johannes Altmanninger
f4d0bafbd4 remove stale typedef 2020-01-30 16:32:47 +01:00
David Adam
696057ab57 Merge branch 'Integration_3.1.0' 2020-01-30 17:31:43 +08:00
David Adam
b313ba555a iothread: add missing #include
Closes #6553.
2020-01-30 17:21:15 +08:00
ridiculousfish
40ff4215a8 Express the "nested job control" idea directly
Prior to this fix, we would infer that nested jobs need job control.
Just pass that along explicitly in the job lineage.
2020-01-29 16:10:28 -08:00
ridiculousfish
28a8d0dbf7 Continued adoption of autoclose_fd_t and exec_close 2020-01-29 14:16:16 -08:00
ridiculousfish
3d47f042ac Be more consistent about using autoclose_fd_t and exec_close
Simplifying and improving file descriptor handling discipline.
2020-01-29 13:55:20 -08:00
ridiculousfish
29af84d733 Migrate get_interpreter into postfork.cpp
It's only used after fork.
2020-01-29 13:43:40 -08:00