Commit graph

12850 commits

Author SHA1 Message Date
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
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