Commit Graph

10089 Commits

Author SHA1 Message Date
Aaron Gyes
3b97e2d7ec Stop caching set_color output in rest of prompts
No more __fish_prompt_* variables.
2019-04-09 03:40:09 -07:00
Aaron Gyes
5f7f4c638f informative.fish: stop caching_set_color, use br* directly
No longer uses global vars to cache set_color output, this was
from before set_color was a builtin, it is pointless now.

This is also a prompt from before we had bright named colors,
and it appears it was relying on -o red to get bright red.
so use brred, etc.
2019-04-09 03:13:45 -07:00
Aaron Gyes
b002eb350c Get rid of __fish_repaint_root
it's identical to __fish_repaint - so just register that for both
variable change events.
2019-04-09 00:29:22 -07:00
ridiculousfish
ef88e959ac Merge branch 'pygments'
This adds support for a fish_indent driven pygments syntax highlighter
to the sphinx docs build.
2019-04-08 20:14:12 -07:00
ridiculousfish
1fb05d8fa0 Add fish specific css to docs 2019-04-08 19:13:58 -07:00
ridiculousfish
e85cb25883 Switch to fish_indent based syntax highlighting in sphinx docs 2019-04-08 19:11:22 -07:00
ridiculousfish
93cc99d6d0 Teach CMake to tell Sphinx where fish_indent is 2019-04-08 19:11:10 -07:00
ridiculousfish
5b2c741f6c Add fish_indent_lexer.py
This is a pygments lexer that shells out to fish_indent
2019-04-08 19:09:53 -07:00
ridiculousfish
e44cb235a7 Add pygments CSV output to fish_indent
This will allow pygments to highlight fish code using fish_indent.
2019-04-08 19:09:41 -07:00
ridiculousfish
51e5077d98 Merge branch 'env_dispatch'
This merges a bunch of changes that migrate logic from env.cpp to a new file
env_dispatch.cpp. env_dispatch is concerned with dispatching changes to
variables, while env.cpp is the "core."
2019-04-08 16:22:22 -07:00
ridiculousfish
3e14f96d40 Eliminate string_set_contains 2019-04-08 16:22:04 -07:00
ridiculousfish
1caf20f7c3 Migrate the read limit into env_dispatch 2019-04-08 16:22:04 -07:00
ridiculousfish
fa0a6ae096 Move locale and curses init from env to env_dispatch 2019-04-08 16:22:04 -07:00
ridiculousfish
11651dec7a Clean up env_stack_t::pop
Use the new dispatch mechanism to reduce duplication
2019-04-08 16:22:04 -07:00
ridiculousfish
a4fe3c87ae Switch certain environment callbacks from named to anonymous 2019-04-08 16:22:04 -07:00
ridiculousfish
987e41de12 Remove the op from env_dispatch
Environment dispatch passes strings like "ERASE" and "SET" but nobody
ever looks at those. Just get rid of them.
2019-04-08 16:22:04 -07:00
ridiculousfish
dc729653be Migrate pop complexity from vars_stack_t to env_stack_t
When popping a scope from the environment stack, we currently do a lot of
nonsense like looking for changed curses variables. We want to centralize
this in env_stack_t so that it can be migrated to the env_dispatch logic.
Move this logic up one level in preparation for doing that.
2019-04-08 16:22:04 -07:00
ridiculousfish
59fb5b1849 var_stack_t::pop() to return the popped node 2019-04-08 16:22:04 -07:00
ridiculousfish
0c5809a088 Minor cleanup of env_node_t 2019-04-08 16:22:04 -07:00
ridiculousfish
ab67354192 Migrate fish_use_posix_spawn into env_dispatch 2019-04-08 16:22:04 -07:00
ridiculousfish
e7de9cc371 Migrate some env initialization into env_dispatch 2019-04-08 16:22:04 -07:00
ridiculousfish
b67174b4a3 Clean up env_dispatch_table 2019-04-08 16:22:04 -07:00
ridiculousfish
b7fceddfc8 Refactor some environment code into env_dispatch.cpp
This new file is supposed to encapsulate all of the logic around
reacting to variable changes, as opposed to the environment core.
This is to help break up the env.cpp monolith.
2019-04-08 16:22:04 -07:00
Aaron Gyes
e5362a4ae5 wutil.cpp: fixup: don't involve the uninitialized parameter 2019-04-08 16:02:00 -07:00
Aaron Gyes
8eb05f8731 parse_execution.cpp: validate 'for' variable name
Fixes #5800
(that's a nice round number)
2019-04-08 11:23:00 -07:00
Aaron Gyes
dd9a26715d fcntl a little less
Setting O_CLOEXEC on closed file descriptors and getting E_BADF
should be faster than actually checking if an fd is open first.
2019-04-08 11:23:00 -07:00
ridiculousfish
bf40f84b06 Remove an unused variable 2019-04-07 15:07:36 -07:00
ridiculousfish
35b3f7fee8 Reduce loop count of pipeline test
Make the test run faster
2019-04-07 15:00:13 -07:00
ridiculousfish
f5bb8639d6 More aggressively inherit pgrps from parent jobs
Prior to this fix, a job would only inherit a pgrp from its parent if the
first command were external. There seems to be no reason for this
restriction and this causes tcsetgrp() churn, potentially cuasing SIGTTIN.
Switch to unconditionally inheriting a pgrp from parents.

This should fix most of #5765, the only remaining question is
tcsetpgrp from builtins.
2019-04-07 13:35:00 -07:00
ridiculousfish
4d62af7d40 Add pipeline tests
This adds a pipeline test covering the fix in the prior commit,
related to #5675. Note #5675 is NOT fully fixed by this.
2019-04-07 09:20:32 -07:00
ridiculousfish
39a9740997 Be less aggressive about reclaiming the foreground pgrp
Prior to this fix, in every call to job_continue, fish would reclaim the
foreground pgrp. This would cause other jobs in the pipeline (which may
have another pgrp) to receive SIGTTIN / SIGTTOU.

Only reclaim the foreground pgrp if it was held at the point of job_continue.

This partially addresses #5765
2019-04-07 09:20:32 -07:00
ridiculousfish
23d88e0e03 Add fish_test_helper executable
In tests we would like to arrange for an executable to invoke certain
system calls, e.g. to claim or relinquish control of the terminal. This is
annoying to do portably via e.g. perl. fish_test_helper is a little
program where we can add custom commands to make it act in certain ways.
2019-04-07 09:20:19 -07:00
Fabian Homborg
4d66c7896f docs: Fix some more formatting
One monster paragraph and two lists that weren't recognized as such.

RsT loves empty lines.

[ci skip]
2019-04-06 23:38:07 +02:00
Fabian Homborg
a447878cd7 docs: Remove &foo; escapes
I always hated these.

[ci skip]
2019-04-06 23:33:07 +02:00
Fabian Homborg
c4d0177d81 docs: Put some more important variables first
This section was linked when talking about $PATH, and $PATH is much
more important than $fish_color_something and $fish_emoji_width.

[ci skip]
2019-04-06 23:29:05 +02:00
Fabian Homborg
235266894b docs: Fix reference to FAQ
This adds a reference to one specific FAQ, so it adds a label for that
one question. It does not add the rest, because they currently aren't
linked. If you add a reference to an FAQ, you should add the label as
well.

[ci skip]
2019-04-06 23:23:48 +02:00
Fabian Homborg
78931d78bd completions/git: Handle diff --cached
Fixes #5785.

[ci skip]
2019-04-06 21:45:17 +02:00
Fabian Homborg
f1614a995a docs: Reword commandline -f
We don't refer to "readline functions" anywhere else, and "injecting"
them "into the reader" is an overly jargony way of expressing it that
only makes sense to someone familiar with the internals. And even then
the term "readline" is already taken by the "readline" library, used
by bash et al, but not by us.

So we pick the term "input functions", like we did in bind.

See https://stackoverflow.com/questions/55542839/what-does-commandline-f-repaint-in-fish-shell/55543411#55543411.

[ci skip]
2019-04-06 20:39:16 +02:00
Aaron Gyes
4e555aebec Remove is_whitespace and whitespace character string declarations
I don't doubt such functions and character arrays could be useful,
to keep things consistent, but they are not actually being used.
2019-04-06 02:07:56 -07:00
Fabian Homborg
21ef9f5150 docs: Remove fish_vi_mode documentation
This has been deprecated for quite a while, no need to keep the docs around.

[ci skip]
2019-04-05 14:09:41 +02:00
Fabian Homborg
357a572b43 docs/index: Document repaint-mode
This was only mentioned in passing in the bind docs.

[ci skip]
2019-04-05 14:08:58 +02:00
Fabian Homborg
2a3677b386 Stop setting term-modes early
This set the term modes to the shell-modes, including disabling
ICRNL (translating \cm to \cj) and echo.

The rationale given was that `reader_interactive_init()` would only be
called >= 250ms later, which I _highly_ doubt considering fish's total
startup time is 8ms for me.

The main idea was that this would stop programs like tmuxinator that
send shortcuts early from failing _iff_ the shortcut was \cj, which
also seems quite unusual.

This works both with `rm -i` and `read` in config.fish, because `read`
explicitly calls `reader_push`, which then initializes the shell modes.

The real fix would involve reordering our init so we set up the
modesetting first, but that's quite involved and the remaining issue
should barely happen, while it's fairly common to have issues with a
prompt in config.fish, and the workaround for the former is simpler, so let's leave it for now.

Partially reverts #2578.

Fixes #2980.
2019-04-05 12:55:13 +02:00
Mahmoud Al-Qudsi
2e6264558c Fix remaining realpath test issue with symlinks
Pursuant to 0be7903859, there still
remained one issue with the test when run from within a symlinked
directory after fish gained support for cding into symlinks.

This change should make the test function OK both when the tests are run
out of a PWD containing a symlink in its hierarchy and when run
otherwise.
2019-04-04 22:25:45 -05:00
Aaron Gyes
be80a56ad4 expand.cpp: use wcspbrk for is_quotable 2019-04-04 17:32:39 -07:00
Aaron Gyes
b4ddd797e3 remove unused wcstring 2019-04-04 14:24:36 -07:00
Aaron Gyes
b064eaa571 use std::move in a couple spots where things were unsed after copy 2019-04-04 14:16:34 -07:00
Aaron Gyes
09e8f0fd7c rearrange structure fields
Putting larger members before smaller ones will reduce structure
sizes. bools are 1 byte. on 64bit systems I think they reduced:

wgetopt.h:46: 64 to 56 bytes
builtin_history.cpp:30: 48 to 32 bytes
builtin_status.cpp:91: 32 to 24 bytes
tinyexpr.cpp:69: 40 to 32 bytes
2019-04-04 13:47:10 -07:00
Mahmoud Al-Qudsi
bc66921ac9 Optimize keyword detection
The data stored in these containers is small enough that it is worth
creating distinct sets for each lookup.

In a microbenchmark of these changes, the single-lookup version of the
function with lookups gated on the length of input (bypassed entirely if
the input is longer than the longest key in the container) provided a
1.5x-3.5x speedup over the previous implementation.

Additionally, as the collections are static and their contents are never
modified after startup, it makes no sense to continously calculate the
location of and allocate an iterator for the `!= foo.end()` comparison;
the end iterator is now statically cached.

I'm not expecting massive speed gains out of this change, but the parser
does perform enough of these to make it worth optimizing in this way.
2019-04-03 20:53:29 -05:00
ridiculousfish
e2ed6baf43 Make the output/errput test more robust by sorting output 2019-04-03 16:50:13 -07:00
Fabian Homborg
318fe3c046 docs/string: Replace doesn't do globs
As a bit of weirdness in string's design, replace does literal
matching (`*` aren't expanded) by default, not globs.

[ci skip]
2019-04-03 19:49:38 +02:00