Commit Graph

10015 Commits

Author SHA1 Message Date
Fabian Homborg
71a2337c5f Remove stray newlines in test
Sorry!
2019-03-26 17:18:25 +01:00
Fabian Homborg
39a601927f Remove useless empty lines from stack traces
This printed things like

```
in function 'f'
        called on standard input

in function 'd'
        called on standard input

in function 'b'
        called on standard input

in function 'a'
        called on standard input

```

As a first step, it removes the empty lines so it's now

```
in function 'f'
        called on standard input
in function 'd'
        called on standard input
in function 'b'
        called on standard input
in function 'a'
        called on standard input
```

See #5434.
2019-03-26 16:47:42 +01:00
Fabian Homborg
b86200938f Always use "." for cd
Nobody doesn't want to use $PWD to cd, so if $CDPATH does not include
it that was a mistake.

Bash also appends "." here.

Fixes #4484.
2019-03-26 10:11:36 +01:00
ridiculousfish
eeec6cc2fc Remove a single use of env_stack_t::principal 2019-03-25 02:27:02 -07:00
ridiculousfish
989f992a75 Rearrange and inline some env code 2019-03-25 00:49:52 -07:00
ridiculousfish
ea3a368c50 Make env_var_t store its values via shared_ptr
This switches env_var_t to be an immutable value type, and stores its
contents via a shared_ptr. This eliminates string copying when fetching
env_var_t values.
2019-03-25 00:41:04 -07:00
ridiculousfish
93d70fae11 Relnote stop buffering deferred function processes 2019-03-24 21:39:39 -07:00
ridiculousfish
5eade35257 Stop buffering deferred function processes
If a function process is deferred, allow it to be unbuffered.
This permits certain simple cases where functions are piped to external
commands to execute without buffering.

This is a somewhat-hacky stopgap measure that can't really be extended
to more general concurrent processes. However it is overall an improvement
in user experience that might help flush out some bugs too.
2019-03-24 21:23:26 -07:00
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