Commit Graph

10366 Commits

Author SHA1 Message Date
ridiculousfish
3bbee06248 Introduce the notion of a deferred process
In a job, a deferred process is the last fish internal process which pipes
to an external command. Execute the deferred process last; this will allow
for streaming its output.
2019-03-24 14:27:23 -07:00
ridiculousfish
165c82e68a Promote process_type_t to an enum class 2019-03-24 12:29:25 -07:00
ridiculousfish
96b8ac7013 Promote job_control_t to an enum class 2019-03-24 12:12:44 -07:00
Fabian Homborg
99d77c6049 docs: Replace &.arr; markup with unicode arrows
This is still missing the @cursor_keys bit.

See #5696.

[ci skip]
2019-03-24 20:03:52 +01:00
Fabian Homborg
848d538f08 docs: Replace @key markup with :kbd:
The best I could find. It doesn't currently appear to render in the
html, but it's better than showing `@key{thing}`.
2019-03-24 19:59:23 +01:00
Fabian Homborg
8837d17910 docs: Remove weird Commands subsection
This included another copy of the TOC in the middle of the index page
and called it "Commands"?

See #5696.

cc @ridiculousfish

[ci skip]
2019-03-24 19:51:27 +01:00
Fabian Homborg
295286b184 docs: Fix remaining "\subsection" markup
See #5696.

[ci skip]
2019-03-24 19:44:56 +01:00
Fabian Homborg
77e71cfcb1 completions/git: Handle AM files
Fixes #5763.

[ci skip]
2019-03-24 17:12:36 +01:00
Fabian Homborg
22d9382646 completions/service: Remove useless helper function
[ci skip]
2019-03-24 16:59:49 +01:00
Fabian Homborg
5afd1336e8 functions/fish_npm_helper: Use physical pwd
This searched for package.json in any parent, so just like finding
.git and .hg directories it _needs_ to use the physical pwd because
that's what git/hg/yarn use.

In general, if you do _any_ logic on $PWD, it should be the physical
path. Logical $PWD is basically only good for display and cd-ing
around with symlinks.

[ci skip]
2019-03-24 10:49:04 +01:00
ridiculousfish
b270ca8804 Merge branch 'input_cleanup'
This merges a bunch of changes that clean up how the reader loop and input
works.

Prior to this fix, we abused wchar_t by cramming readline functions into
"private" regions. Readline functions then were further abused with
meta-readline functions like R_NULL or R_TIMEOUT.

This fix introduces a new type char_event_type_t which wraps up the "meta"
character types. A char event may be a null (try again), timeout, readline,
or real input character. These are all distinct values.

The reader loop is then refactored to handle these cases separately.
2019-03-23 23:35:03 -07:00
ridiculousfish
71f26a6813 Remove INPUT_COMMON_BASE
We no longer store readline commands as characters, so there's no need to
reserve character space for them.
2019-03-23 23:31:37 -07:00
ridiculousfish
e7d7eff0ee Rename all readline commands to lowercase and remove R_ prefix 2019-03-23 23:31:35 -07:00
ridiculousfish
9187458d51 Continued refactoring of reader_data_t::readline 2019-03-23 23:31:34 -07:00
ridiculousfish
6ba94fd81b Factor readline command handling into new function handle_readline_command() 2019-03-23 23:31:33 -07:00
ridiculousfish
42f4d2bd86 Factor out the "read coalescing" part of reader_data_t::readline 2019-03-23 23:31:31 -07:00
ridiculousfish
7ae7865071 Factor reader_data_t::readline state into a new struct
Will help break up this monster.
2019-03-23 23:31:29 -07:00
ridiculousfish
6aba28ad3d Add missing cases to readline loop
Handle all readline commands in our switch.
2019-03-23 23:31:27 -07:00
ridiculousfish
2c56e27d37 Switch readline commands to readline_cmd_t enum class 2019-03-23 23:31:25 -07:00
ridiculousfish
0841072462 Minor cleanup of kill ring 2019-03-23 23:31:24 -07:00
ridiculousfish
b68d3b84de Switch input_function_get_code() to return maybe_t 2019-03-23 23:31:22 -07:00
ridiculousfish
c2be5e8986 Introduce char_event_type_t::readline
Baby steps towards eliminating readline actions as characters.
2019-03-23 23:31:18 -07:00
ridiculousfish
14663089c8 Finish removing R_NULL 2019-03-23 23:31:09 -07:00
ridiculousfish
28b79a2c88 Some further steps towards removing R_NULL
Introduce char_event_type_t::check_exit to represent "check for exit"
instead of R_NULL.
2019-03-23 23:31:01 -07:00
ridiculousfish
70a92a9710 Switch interrupt_handler to return maybe_t<char_event_t>
Prepares to remove R_NULL
2019-03-23 23:13:19 -07:00
ridiculousfish
1ef2404e1c readb to return char_event_t
Avoids some annoying type conversions.
2019-03-23 23:12:50 -07:00
ridiculousfish
46dfad52d9 Switch the input interrupt function to return maybe_t
Allow returning none() to mean do nothing.
2019-03-23 23:12:12 -07:00
ridiculousfish
1e5c1c82c7 Rename and simplify input_read_characters_eof_only
Clarify its role.
2019-03-23 23:11:45 -07:00
ridiculousfish
00f24695fe Remove R_EOF
Promote R_EOF to a new char_event_type_t instead of keeping it as a char
value.
2019-03-23 23:11:23 -07:00
ridiculousfish
185805641c Remove R_TIMEOUT
Promote timeout to a char_event_type_t, moving it out of the "char" namespace.
This will help simplify the readline implementation.
2019-03-23 20:10:06 -07:00
Aaron Gyes
a2a9709fd9 Don't truncate hostnames over 32 characters
I believe this was selected to be artificially low for the sake
of it displaying well in prompts. But people should expect to get
the same output as can be gotten from `hostname`.

Fixes #5758
2019-03-23 12:34:48 -07:00
Aaron Gyes
7a74198aa3 parser: try to avoid some strings being copied 2019-03-23 12:34:48 -07:00
Fabian Homborg
25ba16d4b6 functions/help: Cleanup 2019-03-22 12:48:26 +01:00
Fabian Homborg
4c61691377 functions/help: Don't eval to check for lynx
This called `eval $fish_browser --version` to figure out if it is
lynx.

That's really not worth it just to support edge-cases using a rather
unusual browser, to work around a bug in it.

Instead we just see if the browser name starts with "lynx", which
should work in 99.9% of cases.
2019-03-22 12:38:23 +01:00
Fabian Homborg
21c8be8cd1 functions/help: Use open command everywhere
See #5756.

[ci skip]
2019-03-22 09:09:57 +01:00
GReagle
277a94c118 FAQ: how to check whether variable is defined or not empty (#5732)
* FAQ: how to check whether variable is defined or not empty

* FAQ: how to check whether variable is not empty: include test in answer
2019-03-21 10:24:08 +01:00
Mahmoud Al-Qudsi
d467a1a145 Merge branch 'dynamic_wcwidth'
This merges in a number of improvements specifically aimed at console
sessions (i.e. using fish at the tty, not over SSH or in an X-based
terminal emulator). When a console session is detected, the system
wcwidth is used to line up width info between fish and the system tty,
and only simple characters are used as symbols.

Tested under Linux, macOS, FreeBSD, Solaris, Cygwin, WSL, and others.

Closes #5552. Ref #789, #3672.
2019-03-20 21:48:50 -05:00
Mahmoud Al-Qudsi
a1cba81d13 Add note about console session improvements to CHANGELOG 2019-03-20 21:47:34 -05:00
Mahmoud Al-Qudsi
c50cce298d Allow the omitted new line character to be more than one char
The code already allowed for variable width (multicell) *display* of the
newline omitted character, but there was no way to define it as being
more than one `wchar_t`.

This lets us use a string on console sessions (^J aka newline feed)
instead of an ambiguous character like `@` (used in some versions of
vim for ^M) or `~` (what we were using).
2019-03-20 21:47:34 -05:00
Mahmoud Al-Qudsi
753d489376 Fall back to simpler special characters in console sessions 2019-03-20 21:47:34 -05:00
Mahmoud Al-Qudsi
da8e343076 Use is_console_session() to signal using system wcwidth()
The system version of `wcwidth()` reflects the capabilities of the
system's own virtual terminal's view of the width of the character in
question, while fish's enhanced version (`widechar_wcwidth`) is much too
smart for most login terminals, which generally barely support anything
beyond ASCII text.

If, at startup, it is detected that we are running under a physical
console rather than within a terminal emulator running in a desktop
environment, take that as a hint to use the system-provided `wcwidth`.
2019-03-20 21:47:34 -05:00
Mahmoud Al-Qudsi
4aded78fc9 Add is_console_session() to detect physical vty 2019-03-20 21:47:32 -05:00
Mahmoud Al-Qudsi
f2896b2d83 Fix junk memory read introduced in 1cd5b2f4e1
The commit began passing the length of the wide string rather than the
length of the narrowed string after conversion via `wcstombs`. We *do*
have the actual length, but it's not (necessarily) the same as the
original value. We need to pass the result of `wcstombs` instead.
2019-03-20 20:51:22 -05:00
Fabian Homborg
a8b01e1c99 src/output: Unconst-cast tputs
Fixes the build on Solaris/OpenIndiana/Illumos.
2019-03-20 09:01:46 +01:00
Fabian Homborg
1a53bbeb9d src/fallback: Include locale.h for the wcstod_l fallback
Fixes #5753.
2019-03-20 08:54:40 +01:00
Fabian Homborg
f8b88d5b98 docs/fish_git_prompt: Better document variables
More accurate, also the code example can now be copy-pasted.

[ci skip]
2019-03-19 21:07:49 +01:00
Fabian Homborg
a649c5293e functions/fish_git_prompt: Fix space prefix for verbose showupstream
This created another local version of the variable just for the if-block.

Can't say I love the space prefix, but then I think we have too many
of these modes anyway.
2019-03-19 10:27:52 +01:00
Fabian Homborg
f6226f0802 functions/fish_git_prompt: Useful status for show_upstream
Returns 0 if there is no diversion, 1 otherwise.
2019-03-19 10:24:40 +01:00
Fabian Homborg
632c47be54 functions/fish_git_prompt: Remove literal tabs 2019-03-19 10:24:34 +01:00
Fabian Homborg
05ef157757 functions/fish_git_prompt: Let helper functions return useful status
If you use these to figure out if there _are_ staged files, or dirty
or whatever, you currently need to check the output, which relies on
the configured character.

Instead, we let them also return a useful status.
Notably, this is *not* simply the status of the git call.

__fish_git_prompt_X returns 0 if the repo is X.

This works for untracked, but the "diff" things return 1 if there is a
diff, so we invert the status for them.

See #5748.

[ci skip]
2019-03-19 10:11:37 +01:00