Commit Graph

10346 Commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
6fab783647 Convert job_list to a dequeue again
Now that we have cleaned up access to the job list and removed
transparent invalidation of iterators, it is safe to convert it to a
dequeue.
2019-03-28 18:55:36 -05:00
Mahmoud Al-Qudsi
f8e0e0ef82 Remove abstractions around job list
Directly access the job list without the intermediate job_iterator_t,
and remove functions that are ripe for abuse by modifying a local
enumeration of the same list instead of operating on the iterators
directly (e.g. proc.cpp iterates jobs, and mid-iteration calls
parser::job_remove(j) with the job (and not the iterator to the job),
causing an invisible invalidation of the pre-existing local iterators.
2019-03-28 18:55:36 -05:00
Mahmoud Al-Qudsi
0c5015d467 Correct the reversed diff output for all tests
This has been driving nuts for years. The output of the diff emitted
when a test fails was always reversed, because the diff tool is called
with `${difftool} ${new} ${old}` so all the `-` and `+` contexts are
reversed, and the highlights are all screwed up.

The output of a `make test` run should show what has changed from the
baseline/expected, not how the expected differs from the actual. When
considered from both the perspective of intentional changes to the test
outputs and failed test outputs, it is desirable to see how the test
output has changed from the previously expected, and not the other way
around.

(If you were used to the previous behavior, I apologize. But it was
wrong.)
2019-03-28 18:23:32 -05:00
Fabian Homborg
6cf61d5235 docs/fish_git_prompt: Fix formatting
Sphinx likes empty lines before lists.

Also give variable names the ``treatment``.

[ci skip]
2019-03-28 22:11:28 +01:00
Fabian Homborg
c94fe0f8c9 docs/fish_git_prompt: Document default settings
This should help with interpreting the results.

All this is quite convoluted, especially with defaults dependent on
other settings.

[ci skip]
2019-03-28 21:16:05 +01:00
Fabian Homborg
42acbaa5af Remouve ouveroused U
Webster was right, gosh dang it!

[ci skip]
2019-03-28 12:31:52 +01:00
Fabian Homborg
21d8b465cc nextd/prevd: Print BEL instead of "Hit end of history"
That message is just hugely annoying.

Hat-tip to @floam and d524bad5f16b5a18c22fefe440.
2019-03-28 11:58:53 +01:00
ridiculousfish
5441ebc91f Remove some dead code 2019-03-28 00:38:12 -07:00
Fabian Homborg
785945c861 src/builtin_test: Print backtrace on error
`test` is a common source of problems, and with the current system
they can be quite hard to find.

So we print a backtrace with line numbers and all.
2019-03-28 08:35:32 +01:00
Fabian Homborg
d8ec4685ff src/builtin_test: Remove weird leading tab from error message
This is a remainder from when we used to speak of "eval errors".
2019-03-28 08:35:32 +01:00
Fabian Homborg
e2ce63ff62 functions/help: Adjust command paths to sphinx
We now build a separate page per-command in cmds/$cmd.html instead of
a section in the "commands.html" page.

See #5696.

[ci skip]
2019-03-27 12:46:51 +01:00
Fabian Homborg
4e7795217d docs: Replace @cursor_key
Should be the last of them.

See #5696.

[ci skip]
2019-03-27 12:44:10 +01:00
Fabian Homborg
6a9079899d docs: Add an annotated completion example
It's not _perfect_, but should hopefully ease the introduction a
teensy bit.

We use `timedatectl` because it's a reasonably simple command that
still uses subcommands and some generated candidates.

[ci skip]
2019-03-27 12:40:38 +01:00
Fabian Homborg
2a51e42ee0 functions/help: Try harder to find a browser on WSL
We now try cmd.exe via $PATH and via a common location, wsl-open, and
an open command.

Fixes #5756.

[ci skip]
2019-03-27 09:06:11 +01:00
Fabian Homborg
248200520e functions/help: Prefer xdg-open/cygstart over open
Some systems like Debian have "open" as a symlink to "openvt" (for... historical
reasons).

See #5756.

[ci skip]
2019-03-27 09:06:11 +01:00
Fabian Homborg
54156845e4 CHANGELOG error changes
[ci skip]
2019-03-26 19:33:26 +01:00
Fabian Homborg
7fa454666d Only append newline if stacktrace isn't empty
This printed weird things like

```fish
$ functions -x
functions: Unknown option '-x'

(Type 'help functions' for related documentation)
```

Instead, let's make it

```fish
$ functions -x
functions: Unknown option '-x'
(Type 'help functions' for related documentation)
```
2019-03-26 19:32:18 +01:00
Fabian Homborg
88d2d54276 Stop printing help summary on error
This now displays

- the error message

- a (significantly shorter) backtrace

- A call to open `help $cmd` if necessary

See #5434.
Fixes #3404.
2019-03-26 19:24:48 +01:00
Fabian Homborg
88a935d8d1 Escape arguments in stacktraces
See #5434.
2019-03-26 17:45:25 +01:00
Fabian Homborg
7095de628c Remove "called on standard input" message
This was printed basically everywhere.

The user knows what they executed on standard input.

A good example:

```fish
set c (subme 513)
```

used to print

```
fish: Too much data emitted by command substitution so it was discarded

    set -l x (string repeat -n $argv x)
             ^
in function 'subme'
	called on standard input
	with parameter list '513'
in command substitution
	called on standard input
```

and now it is

```
fish: Too much data emitted by command substitution so it was discarded

    set -l x (string repeat -n $argv x)
             ^
in function 'subme' with arguments '513'
in command substitution
```

See #5434.
2019-03-26 17:38:41 +01:00
Fabian Homborg
975023faf2 Print arguments on the same line as the function
Now:

```
cd: Unknown option '-r'
~/dev/fish-shell/share/functions/cd.fish (line 40):
    builtin cd $argv
    ^
in function 'cd' with arguments '-r'
in function 'f'
in function 'd'
in function 'b' with arguments '-1q --wurst'
in function 'a'
	called on standard input
```

See #5434.
2019-03-26 17:37:16 +01:00
Fabian Homborg
e723f02aa7 Remove empty line also for event handlers 2019-03-26 17:18:25 +01:00
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