Commit Graph

12354 Commits

Author SHA1 Message Date
ridiculousfish
8a27873598 Remove redundant expect tests
With the new pexpect based framework, bind and pipeline expect tests can
be removed.

Amusingly the complete.fish check required the existence of bind.expect.
Fix the check at the same time.
2020-06-07 14:53:17 -07:00
ridiculousfish
4ae4314e63 Improve pexpect output
Make it easier to use pexpect and to understand its error messages.
Switch to a style in tests using bound methods, which makes them
less noisy to write.
2020-06-07 14:53:17 -07:00
ridiculousfish
3b7feb38e9 Add pexpect-based interactive testing framework
This adds a new interactive test framework based on Python's pexpect. This
is intended to supplant the TCL expect-based tests.

New tests go in `tests/pexpects/`. As a proof-of-concept, the
pipeline.expect test and the (gnarly) bind.expect test are ported to the
new framework.
2020-06-07 14:46:21 -07:00
ridiculousfish
218fe15264 Add 'pip install pexpect' to travis config
In preparation for the new pexpect-based tests, modify
the travis config file to install pexpect.
2020-06-07 14:41:05 -07:00
ridiculousfish
229ead9b8a env_stack_t::set_termsize to operate on self, not global stack 2020-06-07 12:57:34 -07:00
ridiculousfish
064324984b Use consistent variable names in decl and def of calc_prompt_layout 2020-06-07 12:56:14 -07:00
Rosen Penev
9636d9f5d3 [clang-tidy] remove pointless string init
Found with readability-redundant-string-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-07 12:49:35 -07:00
Rosen Penev
67e5473a11 [clang-tidy] remove pointless cstr
Found with readability-convert-member-functions-to-static

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-07 12:49:35 -07:00
Rosen Penev
871a15bf58 [clang-tidy] fix automatic move warning
Found with performance-no-automatic-move

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-07 12:49:35 -07:00
Fabian Homborg
7791457bbb docs: Add string-collect link 2020-06-07 20:04:31 +02:00
Fabian Homborg
a6e4e082b7 docs: Include "fish for bash users" document
Not 100% done, but it should be okay as an overview.

Fixes #2382.
2020-06-07 20:04:05 +02:00
Mikel Ward
96425d2231 Fix string collect examples
collect -N leaves the trailing newline, not the other way around.
2020-06-07 19:33:27 +02:00
Fabian Homborg
37e9a3067f CHANGELOG 2020-06-07 16:28:23 +02:00
Fabian Homborg
9d2bf248ee test: Add tests for error messages 2020-06-07 16:23:29 +02:00
Fabian Homborg
1b4378d39d test: Show indexes starting at 1
We are 1-indexed, and so it's weird to have `test` count its arguments
from 0.

For `test 1 =` this changes the error from

test: Missing argument at index 2
1 =
    ^

to

test: Missing argument at index 3
1 =
    ^
2020-06-07 16:23:24 +02:00
Fabian Homborg
8a9e038b4e test: Show a caret for errors
test loves error messages like

test: Missing argument at index 2

without explaining where that "index 2" is.

So now, we print the arguments below that, with a caret pointing to
the place where the error occured.

For example:

    > test 1 = 2 and echo true or echo false
    test: Expected a combining operator like '-a' at index 3
    1 = 2 and echo true or echo false
          ^

    (Type 'help test' for related documentation)

Fixes #6030.
2020-06-07 16:23:10 +02:00
ridiculousfish
971f108bda Mark Intl cmake package as quiet
This suppresses not-very-interesting messages from CMake about whether
Intl was found or not.

Fixes #7091
2020-06-06 18:56:54 -07:00
ridiculousfish
783a895b11 Mark PCRE2's packages as quiet
This suppresses certain CMake messages about PCRE2 features that are not
relevant for fish. See #7091.
2020-06-06 18:55:55 -07:00
ridiculousfish
61e948454f Do even less work for empty commands
Inspired by #4829, skip further work when running a command
interactively if that command is empty.
2020-06-06 17:17:22 -07:00
Awal Garg
cb5eb72c6b Skip pre/post exec events for empty commands (#4829) 2020-06-06 16:31:33 -07:00
David Adam
c5e535e794 docs: link and explicit instructions on creating a blank fish_mode_prompt
Work on #5783.

[ci skip]
2020-06-06 22:52:13 +08:00
Fabian Homborg
0846fc8181 Manparser: Also replace \(cq escapes in the non-Deroff manparser
I'm not entirely sure why we have multiple parsers here, but I'm
guessing there's a reason.

Fixes #7086.
2020-06-06 16:23:43 +02:00
Fabian Homborg
ab2db135ba docs: Add first draft of fish-vs-bash
That name's probably not the correct one.

The idea is to have a quick primer document for people coming from bash.
2020-06-05 19:19:23 +02:00
Fabian Homborg
801ab95fd0 docs: Explain $XDG_CONFIG_HOME 2020-06-05 19:18:09 +02:00
Fabian Homborg
77fc83c293 docs: Reword history substitution
That prepend-sudo note was a bit awkward. I'm still not super happy
with it, but it should be better.

Also remove the "simple but effective" comment.
2020-06-05 19:17:19 +02:00
Fabian Homborg
a8d1eb83da CHANGELOG
[ci skip]
2020-06-04 18:29:31 +02:00
Fabian Homborg
e646285bcb
Let __fish_prepend_sudo use the last commandline if there is no current one (#7079)
* docs/faq: Mention prepend_sudo

[ci skip]

* __fish_prepend_sudo: Use $history[1] if commandline is empty

Currently, if you press alt+s with an empty commandline, it inserts
"sudo", which seems fairly useless.

Now, it inserts "sudo " followed by the last history entry, which
makes it a replacement for `sudo !!`.

* docs
2020-06-04 18:25:02 +02:00
Charles Gould
3692d63188 completions: shorten fzf descriptions 2020-06-04 18:24:11 +02:00
Charles Gould
0f4ed5b6b8 completions: shorten base64 descriptions 2020-06-04 18:24:11 +02:00
Charles Gould
fd2eb26ee3 completions: fix typo for mktemp 2020-06-04 18:24:11 +02:00
Fabian Homborg
44184f68e4 Add status dirname and status basename convenience commands
There's a terrible number of fishscripts that start with

    set path (dirname (status filename))

And that's really just a bit boring.

So let's let it be

    set path (status dirname)
2020-06-04 18:23:32 +02:00
Alexander Sieg
af2d19bde0
completions: add hikari completion (#7083)
* completions: add hikari completion

* requested changes by code reviewer
2020-06-04 18:22:25 +02:00
Fabian Homborg
5efe1a09ce docs/argparse: Add note on optional arguments
Yeah I had to answer this one again.

[ci skip]
2020-06-04 17:28:02 +02:00
Fabian Homborg
0064279905 Don't show greetings in read in scripts
This reverts commit 1b0ec21773.

"Interactive" has multiple meanings here, one of them being "the whole shell" is interactive, which `status is-interactive` tests, and one "this interaction is interactive", which happens when `read`ing in a script.

Fixes #7080.
2020-06-04 17:00:09 +02:00
Jason
4dff15b74e
kdeconnect-cli completions: ignore stderror (#7074)
* kdeconnect-cli completions: ignore error messages

* squash this please
2020-06-03 16:12:52 +02:00
Fabian Homborg
f25f15fd69 completions: Fix leftover "^" redirections 2020-06-02 21:43:32 +02:00
Fabian Homborg
1af1e7b69b CHANGELOG: Fix formatting 2020-06-02 17:39:36 +02:00
Kristofer Rye
146ec619d9 Add "alacritty" to the list of known titleable TERMs
This change is necessary to fix dynamic titles for the Alacritty
terminal.  We do this by simply adding the (wchar_t *) literal
L"alacritty" to the end of the title_terms array.  This variable is
ultimately used in the subsequent function
does_term_support_setting_title (dtsst) for the purposes of whitelisting
certain terminals.

If an Alacritty user does not have the terminfo for alacritty present in
their terminfo database, Alacritty sets the TERM variable to
"xterm-256color", but if the terminfo for Alacritty is present, TERM is
instead set to "alacritty".

Prior to this change, none of the "fallback patterns" in the dtsst
function (which is used to ultimately decide whether or not a given
value of the TERM environment variable is supported) would apply to a
value of "alacritty".  Ordinarily, the dtsst function would return true
if nothing matches, but one of the final checks involves testing the
result of ttyname_r to see if it contains the substring "tty", which
causes dtsst to return false.  In the case where TERM="alacritty", this
is erroneous, because Alacritty does, indeed, support changing its title
and will also silently ignore attempts to change the title if that
behavior has been disabled by the user [1].

The changed file, src/env_dispatch.cpp, was reformatted by clang-format
in accordance with the documented procedures for contributors.

Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>

[1]: 1dacc99183/alacritty_terminal/src/term/mod.rs (L896-L900)
2020-06-01 19:06:32 -07:00
Fabian Homborg
4d487f711d Don't use cbegin/cend
This has problems on old gcc, and isn't super necessary.
2020-06-01 15:52:15 +02:00
Fabian Homborg
4e16310940 Some more CHANGELOG 2020-06-01 15:51:45 +02:00
Fabian Homborg
90b01fd915 set: Show pathvariableness in --show 2020-06-01 15:51:10 +02:00
Fabian Homborg
4eb906c8d8 CHANGELOG Work towards 3.2
[ci skip]
2020-06-01 11:52:47 +02:00
John Zhang
8096d10bf1 remove redundant if conditions
All pcre2 resource free functions handle null pointer gracefully.
2020-05-31 17:10:09 -07:00
ridiculousfish
3ae91f197d Remove SIGTTOU handler before restoring foreground process group
When fish exits, it tries to restore the foreground process group.
However this may actually steal control of the fg process group
from another process. Fix this by clearing the SIGTTOU handler so
that tcsetpgrp() will fail.

Credit to @mqudsi for awesome debugging.

Fixes #7060
2020-05-31 14:11:39 -07:00
ridiculousfish
03208acb60 Don't call redirect_tty_output when restoring the front process group
redirect_tty_output was a clumsy attempt to work around a glibc bug, but
it's not necessary if fish is about to exit.
2020-05-31 13:51:47 -07:00
ridiculousfish
a2ae2d6c36 Attempt to truncate prompts that are too wide
Prior to this change, if the user's prompt was wider than the terminal, we
would reduce it to just `> `. With this change, attempt to truncate the
prompt.

For each line of the prompt, calculate its width. If the width exceeds
COLUMNS, prepend ellipsis to that line, and start removing characters
until it fits. Escape sequences are skipped.

Fixes #904
2020-05-31 09:58:47 -07:00
David Adam
2c6e95ccf6 debian packaging: change README.md to README.rst 2020-05-31 17:11:12 +08:00
ridiculousfish
67a4b35838 Migrate cached_layouts into layout_cache_t 2020-05-30 15:00:28 -07:00
ridiculousfish
7cc99a2d80 Rename job_tree to job_group
Initially I wanted to pick a different name to avoid confusion with
process groups, but really job trees *are* process groups. So name them
to reflect that fact.

Also rename "placeholder" to "internal" which is clearer.
2020-05-30 14:22:44 -07:00
ridiculousfish
b119c4b3bb Eliminate pgroup_provenance_t
Now that job trees are a single source of truth for a job's pgid, we no
longer need fancy logic around how the pgroup is assigned.
2020-05-30 14:22:44 -07:00