Commit Graph

13757 Commits

Author SHA1 Message Date
David Adam
3090f8b501 CHANGELOG: work on 3.2.0 2021-02-27 22:45:56 +08:00
Birk Tjelmeland
2719179bc1 Fix pandoc completion error
Pandoc completions would give an error if the folder `~/.pandoc`
does exist. This commit fixes that.
2021-02-27 22:31:42 +08:00
nosed1ve
aa608a42ff
Ensure web_config works on WSL (#7742)
* Ensure web_config works on WSL

web_config could sometimes fail on WSL if the user chose not to append
windows directories to their linux $PATH. This change ensures that the
cmd.exe executable is found in most cases even if windows directories
are not appended to $PATH on linux.

An error message letting the user know that cmd.exe was not found, and
that they should add the cmd.exe dir to their $PATH before running
fish_config is displayed if cmd.exe is still not found.

* Exit with a non 0 status code if cmd.exe is not found
2021-02-25 16:21:34 +01:00
Fabian Homborg
459ac2b566 Reset the readline loop state when setting the buffer
Fixes #7740.
2021-02-25 16:19:28 +01:00
David Adam
39230978b3 docs: call the CHANGELOG "release notes" 2021-02-25 22:46:24 +08:00
Mahmoud Al-Qudsi
42d9f33e16 Use a platform whitelist for opting into the SIGIO notifier
My bet is that the Illumos, Cygwin, and WSL are not the only Unix-like
systems where the SIGIO notifier won't work, and since we have a good
enough and portable alternative that we can use be default on other
platforms where we don't specifically know it'll work, it doesn't make
sense not to go with that one instead.

Even if this patch is reverted at some point and we go back to
blacklisting platforms that *don't* support the SIGIO strategy, this is
almost certainly the right choice for inclusion in a minor release like
3.2.0.

See discussion in #6585.
2021-02-24 14:40:17 -06:00
Fabian Homborg
b8d28158a6 Do disown the completion updating without $last_pid
In this context, as it stands, $last_pid will give fish's pid (because
of pgroup shenanigans).

Since that doesn't really work, just `disown` without and let fish
figure out what the last process was.

Theoretically this has an issue if someone started a background
process *before* the python script *and* that exits before we run
disown.

That's a vanishingly small window and this is only run on first start,
so it seems acceptable.

Fixes #7739.
2021-02-24 20:30:01 +01:00
Fabian Homborg
b154ad6a5c pexpects/fg: Don't use sleep on NetBSD
NetBSD's sleep quits when foregrounded sometimes. I'm not entirely
sure *why*, but this is reproducible with the default /bin/sh, so it's
not our fault.

Because this fails our tests, go back to using cat *there*, because we
can't use it on macOS - 4c9d01cab0.
2021-02-24 20:02:20 +01:00
Fabian Homborg
bb0d4ed878 CHANGELOG: Completion generation still warns
Apparently the fix for #6269 doesn't work until we set job-control to
full, which we won't do for this release.

So just drop it from the CHANGELOG.

See #7739.
2021-02-23 19:47:31 +01:00
Mahmoud Al-Qudsi
ffa24eb361 Fix build on Solaris (and hopefully OpenIndiana)
* memset/memzero needs cstring/string.h (again)
 * winsize_t requires an impl from <sys/termios.h>

With this patch, I was able to get fish master to build on Solaris 11.4
without any additional dependencies (after installing gcc 7, git, and
cmake). I think the ncurses dependency can be dropped from the
OpenIndiana package?
2021-02-23 11:02:55 -06:00
Mahmoud Al-Qudsi
d95e99f2d4 Fix missing memset/memzero on Illumos
Tested w/ GCC 9 under OpenIndiana 2020.
2021-02-22 20:58:42 -06:00
Mahmoud Al-Qudsi
070e6e41ca Remove homebrew dependency in macOS CI workflow
The GitHub documentation states that python3 w/ pip3 is already
installed, and homebrew is slow as molasses (and when it finally runs it
gives a warning about python already being installed and up to date).
2021-02-22 20:35:56 -06:00
Mahmoud Al-Qudsi
17926a9197 Allow low-level tests to at least run to completion under Cygwin
They still don't pass due to path differences, but at least they run to
completion so we can tell just how broken everything is.
2021-02-22 16:27:45 -06:00
Mahmoud Al-Qudsi
d769582023 Ignore intentional redundant move under GCC
This bubbled up after Wredundant-move was added to the build script and
was observed under the CI environment running GCC 9.3.0.
2021-02-22 15:55:40 -06:00
Fabian Homborg
d0a8493844 Don't open pager with only one completion
Since smartcase, we could land in a situation where we offer one
option in the pager, which is awkward.

So detect this and just insert the option directly, we can add any
more smartness later.

Fixes #7738.
2021-02-22 22:51:52 +01:00
Mahmoud Al-Qudsi
050fd342da Support both GCC's Wno-redundant-move and LLVM's Wredundant-move 2021-02-22 15:44:17 -06:00
Mahmoud Al-Qudsi
1305a0899c Fix comparison warnings on UTF-16 platforms
Without true handling of UTF-16 surrogate pairs, all we can do is
properly detect the BMP range in UTF-16 environments and bail if the
input is in a non-BMP region.

There isn't much else we can do as it is incorrect to encode the
surrogate pairs themselves (fish doesn't know what to do with them and
they're illegal under either of UTF-8 or UTF-32).

(I'm not aware of fish being used in any UTF-16 platforms other than
Cygwin.)
2021-02-22 15:03:49 -06:00
Mahmoud Al-Qudsi
215df7eec6 Extend PCRE2 wchar_t interop support to 16-bit wchar_t impls
Previously, the interop glue for more friendly access to PCRE2's
fixed-size values was only used when char32_t/wchar_t were
interchangeable and PCRE2 was used with a global 32-bit unit width set;
this patch extends the same to char16_t when wchar_t is also 16-bits
(namely on Cygwin) to avoid compilation fpermissive warnings about casts
between types of potentially different sizes.

Reported in #6585.
2021-02-22 13:51:29 -06:00
Fabian Homborg
9b763581cf cmake: Only check mbrtowc on Apple
The only thing we know ever triggered this is old macOS versions,
there's no need to use it for everyone else.

Since this uses try_run it breaks when cross-compiling, which
shouldn't be a common thing on macOS.

Fixes #7737
2021-02-22 20:17:17 +01:00
Mahmoud Al-Qudsi
2cf5fd3d5d Avoid hard compilation errors on platforms w/out O_ASYNC
Those platforms should not be using the sigio notifier in the first
place, this just stops them from failing to be able to compile fish
altogether.

See #6585
2021-02-21 22:39:32 -06:00
David Adam
9e1cd95eb1 CHANGELOG: work on 3.2.0 2021-02-21 21:44:26 +08:00
David Adam
e9ec95f875 docs: minor updates to math documentation
Closes #7734.
2021-02-21 21:34:15 +08:00
David Adam
0808e5094b CHANGELOG: work on 3.2.0
Drops the headers for next-minor for now
2021-02-21 10:43:56 +08:00
ridiculousfish
11a373f121 Prevent redirecting internal processes to file descriptors above 2
The user may write for example:

    echo foo >&5

and fish would try to output to file descriptor 5, within the fish process
itself. This has unpredictable effects and isn't useful. Make this an
error.

Note that the reverse is "allowed" but ignored:

    echo foo 5>&1

this conceptually dup2s stdout to fd 5, but since no builtin writes to fd
5 we ignore it.
2021-02-20 16:16:45 -08:00
Ilya Grigoriev
622f2868e1 Fix set -U when fish_variables is a symlink
Previously, `set -U` would overwrite the symlink with a
regular file.

Fixes https://github.com/fish-shell/fish-shell/issues/7466
2021-02-20 14:24:11 -08:00
ridiculousfish
e7d5a40252 Correct description for 'git worktree lock' description
Fixes #7731.
2021-02-20 11:36:36 -08:00
Jason
1f546ac1d0 abbr: improve error handling when --erase called with no args 2021-02-20 11:33:48 -08:00
ridiculousfish
9db51e7156 Relnote fix for 7723 2021-02-17 15:49:55 -08:00
ridiculousfish
8648f52857 Use wcs2string when outputting the screen
The screen output code predates the ENCODE_DIRECT scheme, and
directly-encoded bytes were not being properly output. This manifested as
private-user characters being mangled when printed as part of fish_prompt.
Just use str2wcstring instead.

Fixes #7723
2021-02-17 15:38:46 -08:00
ridiculousfish
f1b6a5939d Introduce wcs2string_appending
wcs2string_appending is like wcs2string, but appends to a std::string
instead of creating a new one. This will be more efficient when a string
can be reused, or if we want to accumulate multiple wcstrings into a
single std::string.
2021-02-17 15:36:22 -08:00
ridiculousfish
fce485e6a8 Rename bufferCount_ to buffer_count_
fish uses snake case for naming.
2021-02-17 14:25:32 -08:00
Mahmoud Al-Qudsi
774488686c Correct handling of SGR mouse tracking events
They are of variable length, taking semicolon-separated ASCII characters
and not single chars/bytes as the parameters. Additionally, the global
maximum size for a CSI is 16 characters (NPAR), even though I believe
the maximum possible mouse-tracking CSI is 12 characters.
2021-02-17 15:45:35 -06:00
ridiculousfish
7e77dc8964 Add a test for round-tripping characters in the private use area
I wrote this test believing that fish had a bug, but actually fish is
behaving correctly here. Still the test is nice so I am checking it in.
2021-02-17 12:29:51 -08:00
ridiculousfish
c0b39aaeb7 Do not reset terminal color when donating term for running key bindings
fish maintains two tty modes: one for itself and one for external
commands. The external command mode is also used when executing
fish-script key bindings, which was added in 5f16a299a7 (note that
commit had the wrong issue, the correct issue is #2114).

Prior to this fix, when switching to external modes, we would also reset
the tty's foreground color. This bumped tty's timestamp, causing us to
believe that the tty had been modified, and then repainting the prompt. If
the prompt were multi-line, we would repaint the whole prompt starting
from its second line, leaving a trailing line above it.

It would be reasonable to save the tty timestamp after resetting the
color, but given that using external modes for keybindings is new, it's
better to instead not reset the color in this case. So migrate the color
resetting to only when we run external commands.

Fixes #7722
2021-02-17 11:10:51 -08:00
Mahmoud Al-Qudsi
75af89699a Patch fish_tests to work with changed const_strlen requirements 2021-02-17 12:55:21 -06:00
Mahmoud Al-Qudsi
70b06a899d Bypass recursion in case of single trailing nul in const_strlen()
The default case for string literals like `"foo"` is a single trailing
nul, and that's what we have almost everywhere. By checking the
second-to-last index for a non-nul byte, we can skip the recursive
invocation, thus speeding up compilation that teeny, tinsy bit faster.
2021-02-17 12:26:40 -06:00
Mahmoud Al-Qudsi
071b9b13cd Reverse const_strlen() recursion logic
Rather than making the run-time complexity of the algorithm 𝒪(n) where n
is the length of the string, make it 𝒪(k) where k is the number of
trailing nul bytes.

The second parameter `index` with a default non-value is in lieu of a
helper function that would have had a name like `count_trailing_nuls()`.
2021-02-17 12:26:40 -06:00
Fabian Homborg
313b70a0c2 math: Set LC_NUMERIC to C again
e94f86e6d2 removed it in favor of using
fish_wcstod, but this broke the *output* - math currently prints
numbers with "," and then can't read them.

So we partially revert it until we come up with something better.
Maybe set $LC_NUMERIC globally inside fish?
2021-02-17 09:07:40 +01:00
Johannes Altmanninger
c0af8dae20 fish_indent: fix extra indent of continuation lines inside blocks
fish_indent used to increment the indentation level whenever we saw an escaped
newline.  This broke because of recent changes to parse_util_compute_indents().
Since parse_util_compute_indents() function already indents continuations
there is not much to do for fish_indent - we can simply query the indentation
level of the newline.  Reshuffle the code since we need to pass the offset
of the newline. Maybe this can even be simplified further.

Fixes #7720
2021-02-16 18:39:03 +01:00
Johannes Altmanninger
444c05dfb1 Do not indent after escaped newline in comment
We do something similar in fish_indent.  This fixes the spurious indent
after comments in share/completions/emerge.fish.

See #7720
2021-02-16 18:39:03 +01:00
Johannes Altmanninger
8b0b987993 README: remove redundant mention of sed dependency 2021-02-16 18:39:03 +01:00
Johannes Altmanninger
7c9da2ce61 CHANGELOG: fix some wrong issue references 2021-02-16 18:39:03 +01:00
Fabian Homborg
b7090c93e6 Fix bind tests
I wasn't aware we printed the fallback bindings anywhere, sorry!

Fixes #7724.
2021-02-16 16:45:59 +01:00
David Adam
39dbcef68d CHANGELOG: work on 3.2.0
This commit brings the changelog up-to-date with the 3.2.0 milestone at the
date of commit.
2021-02-16 22:29:48 +08:00
Fabian Homborg
00fabb4fe1 Enhance fallback keybindings a bit
Bind \cc like normal, since we now no longer use a function, and bind
some important control bindings like \cs and the ever-important emacs \cb/f/p/n.

What really kills the usability here is the up-line vs up-or-search.
2021-02-15 20:54:35 +01:00
Fabian Homborg
477587a4d4 webconfig: Remove more margins on small screens
This still showed the background gradient, which is just a waste and
looks weird.

Instead make the actual content fullscreen (except for the border
radius, for now)
2021-02-15 20:07:24 +01:00
ridiculousfish
c35535dee7 Do not show the history variable in fish_config
The history variable may be so large that it hangs the browser, as
spotted in #7714. Omit this from the variable list.
2021-02-15 10:47:13 -08:00
Fabian Homborg
65a760528a Skip figuring out config with --no-execute
Cuts the time to check all our fish scripts in the
check-all-fish-files.fish test roughly in half, from 3.3s
to 1.8s.
2021-02-15 18:59:54 +01:00
Fabian Homborg
ca4836ff0d Only enable actual flow control on Linux
This fails on FreeBSD on sr.ht and NetBSD on my own VM, but it works manually.

It also fails on macOS but I have no way to confirm.

I think it might be a problem in pexpect's platform support?

Either way, the test is valuable so just skip it there and solve it later.
2021-02-15 17:30:50 +01:00
Fabian Homborg
d6a77cc6f7 Test flow control
This is a bit of an interesting pexpect test, but honestly pexpect
works quite well! I'm happy with it!
2021-02-15 17:30:50 +01:00