Commit graph

12789 commits

Author SHA1 Message Date
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
ridiculousfish
7304815736 Make shell highlighting a toggle instead of a function parameter
Remove the ability to specify the "highlight function." The reader
always highlights via shell highlighting, or doesn't.
2020-08-03 14:10:37 -07:00
ridiculousfish
18c7c46657 Remove highlight_universal
This was an attempt to offer syntax highlighting for `read` when shell
highlighting is not enabled, but it hardly did anything.
2020-08-03 13:41:41 -07:00
ridiculousfish
f94a6a74f0 Remove fish_color_match support
fish_color_match is a variable which controls syntax highlighting for
matching quotes and parens, but only with interactive `read` with shell
highlighting disabled. It seems unlikely that anybody cares about this.
2020-08-03 13:36:47 -07:00
ridiculousfish
af48d09ca6 Improve syntax highlighting variable docs
Make them a table instead of a list, which renders more nicely.
Shorten some of the descriptions.
2020-08-03 13:21:37 -07:00
ridiculousfish
201ca02893 Remove an errant space from the docs
Corrects fish_pager_color_secondary_prefix
2020-08-03 12:19:57 -07:00
Charles Gould
2740473a65 docs: use parsed-literal to highlight interactive examples
There are a few code blocks where the default highlighting does not
work and the documentation looks bad as a result. Usually this happens
when we are demonstrating an important interactive feature, such as
autosuggestions, syntax highlighting, or tab completion.

The pygments highlighter was not designed for code samples like these.
But it is important to show the behavior clearly in the docs. I am
attempting to make these weird examples look as much like the "normal"
code blocks as possible.

https://docutils.sourceforge.io/docs/ref/rst/directives.html#parsed-literal
2020-08-02 14:22:29 -07:00
Johannes Altmanninger
ac1f63781d __fish_complete_suffix: don't fail when a part of the suffix is present
Resolves #7233
2020-08-01 17:04:03 +02:00
Daniel Kravetz
7a77907b62
Update k3d completions (#7232) 2020-08-01 13:41:44 +02:00
Johannes Altmanninger
844c075e83 Update changelog for the new forward-single-char readline command 2020-08-01 12:17:15 +02:00
Olivier FAURE
e7f0b5801d Add forward-single-char input command
This allows users to add custom keybindings to autocomplete only one
character at a time.

Resolves https://github.com/fish-shell/fish-shell/issues/4984
2020-08-01 12:09:31 +02:00
Olivier FAURE
6778d04aa5 Add or keybind input function 2020-08-01 12:09:31 +02:00
David Adam
b990bb1f7a CHANGELOG: work on 3.2.0 and a formatting fix
[ci skip]
2020-08-01 07:35:22 +08:00
ridiculousfish
290236f7e7 Attempt to fix the fg pexpect test
Hypothesize that ^Z is being sent too quickly and add a sleep.
2020-07-31 15:31:55 -07:00
ridiculousfish
d823eee339 Disable code signing by default on the Mac
This has caused too much pain for other packagers.
2020-07-31 12:11:20 -07:00
ridiculousfish
1c2323e76f Use dashes instead of underscores pervasively in tutorial anchors
This fixes some broken help completions.
2020-07-31 12:10:16 -07:00
ridiculousfish
c940af1600 Correct tut_combiners anchor to tut-combiners
dash is preferred in the tutorial. This fixes a broken link from the main
help page.
2020-07-31 11:53:47 -07:00
ridiculousfish
81a39be0bb Support explicitly separated output on stderr
In principle this would allow 'string split' or whatever to output to
stderr and not lose the item separation. In practice this is not used
but it fixes a TODO.
2020-07-30 23:00:34 -07:00
ridiculousfish
bcfc54fdaa Do not buffer builtin output if avoidable
builtins output to stdout and stderr via io_streams_t. Prior to this fix, it
contained an output_stream_t which just wraps a buffer. So all builtin output
went to this buffer (except for eval).

Switch output_stream_t to become a new abstract class which can output to a
buffer, file descriptor, or nowhere. This allows for example `string` to stream
its output as it is produced, instead of buffering it.
2020-07-30 22:45:44 -07:00
ridiculousfish
68092c5d21 Bravely have read_blocked return after first read
In commit fd6d814ea4, read_blocked was changed to read until EOF
or the full amount requested is returned. Switch this to returning
as soon as any data is available, which was the behavior prior to
fd6d814ea4.

This will allow builtin_string to output data in a "streaming"
fashion instead of needing to read a large block up-front.
2020-07-30 22:08:54 -07:00
ridiculousfish
81d5a3ea64 Do not add silent mode history items to history
Prior to this fix, if you invoked fish with --private and then used
`read --silent` to read something sensitive, the variable would be
stored in history, with the plain text available through up-arrow.
Fix it to not store items in silent mode.

Note the item was never written to disk; it was only stored in memory.

Fixes #7230
2020-07-30 20:26:01 -07:00
David Adam
caf64fd0ce CHANGELOG: preliminary work on 3.2.0
[ci skip]
2020-07-30 23:02:41 +08:00
ridiculousfish
f7f35d2373 Fix a warning in fish_tests 2020-07-29 20:12:19 -07:00
ridiculousfish
2809d637db Introduce wwrite_to_fd
wwrite_to_fd() is a function which writes a wide string to a file
descriptor without performing any heap allocations.
2020-07-29 19:38:45 -07:00
ridiculousfish
a0cb23bea5 Introduce wcs2string_callback
This is like wcs2string, but instead of returning a std::string, it invokes
a user-supplied function with each converted character.

The idea is to allow interleaved conversion and output.
2020-07-29 19:36:20 -07:00
ridiculousfish
c9b42c6f1f Stop #include-ing wcstringutil.h in flog.h
This is a header dependency that we can break.
2020-07-29 17:04:18 -07:00
ridiculousfish
db086fc5d4 Eliminate wcs2str
Use std::string variants everywhere instead
2020-07-29 16:37:39 -07:00
ridiculousfish
e4b1fc9f6a Remove stdout_read_limit param from exec_process_in_job
This can always be trivially fetched from the parser - no need to pass it
in separately.
2020-07-29 16:04:29 -07:00
Gokul Soumya
b259fe17f9 vi-keybingings: Add missing abbr triggers for command terminators
Abbr expansion on command terminators were added
back in ec74c739 in response to #6970, but vi mode
was not updated.
2020-07-30 01:04:03 +02:00
ridiculousfish
3506274ccf Make in_foreground an explicit param to continue_job
This moves us slightly closer towards fish code in the background. The idea is
that a background job may still have "foreground" sub-jobs, example:

    begin ; sleep 5 ; end &

The begin/end job runs in the background but should wait for `sleep`.

Prior to this fix, fish would see the overall job group is in the background
and not wait for any of its processes. With this change we detach waiting from
is_foreground.
2020-07-27 15:56:24 -07:00
ridiculousfish
3382bc70d2 Fix a stale comment
[ci skip]
2020-07-27 15:36:43 -07:00
ridiculousfish
c35fe879c7 Bravely remove reclaim... param from continue_job, and rework tcsetpgrp calls
This changes how fish attempts to protect itself from calling tcsetpgrp() too
aggressively. Recall that tcsetpgrp() will "force" itself, if SIGTTOU is
ignored (which it is in fish when job control is enabled).

Prior to this fix, we avoided SIGTTINs by only transferring the tty ownership
if fish was already the owner. This dated from a time before we had really
nailed down how pgroups should be assigned. Now we more deliberately assign a
job's pgroup so we don't need this conservative check.

However we still need logic to avoid transferring the tty if fish is not the
owner. The bad case is when job control is enabled while fish is running in the
background - here fish would transfer the tty and "steal" from the foreground
process.

So retain the checks of the current tty owner but migrate them to the point of
calling tcsetpgrp() itself.
2020-07-27 14:51:37 -07:00
ridiculousfish
1823f5d95f Remove the send_sigcont from continue_job
We can just send sigcont if the job is stopped; no need to make this an
explicit param.
2020-07-27 10:48:32 -07:00
Fabian Homborg
84b25855b0 alias: Escape the first word again
See https://stackoverflow.com/questions/63115744/alias-with-spaces-and-arguments-in-fish-3

This was broken in 115892ccd2
2020-07-27 17:19:44 +02:00
David Adam
7b5160e676 fish.spec: build depends on procps to support new jobs tests 2020-07-27 22:21:37 +08:00