Commit Graph

161 Commits

Author SHA1 Message Date
ridiculousfish
11a373f121 Prevent redirecting internal processes to file descriptors above 2
The user may write for example:

    echo foo >&5

and fish would try to output to file descriptor 5, within the fish process
itself. This has unpredictable effects and isn't useful. Make this an
error.

Note that the reverse is "allowed" but ignored:

    echo foo 5>&1

this conceptually dup2s stdout to fd 5, but since no builtin writes to fd
5 we ignore it.
2021-02-20 16:16:45 -08:00
Ilya Grigoriev
622f2868e1 Fix set -U when fish_variables is a symlink
Previously, `set -U` would overwrite the symlink with a
regular file.

Fixes https://github.com/fish-shell/fish-shell/issues/7466
2021-02-20 14:24:11 -08:00
ridiculousfish
9db51e7156 Relnote fix for 7723 2021-02-17 15:49:55 -08:00
Johannes Altmanninger
7c9da2ce61 CHANGELOG: fix some wrong issue references 2021-02-16 18:39:03 +01:00
David Adam
39dbcef68d CHANGELOG: work on 3.2.0
This commit brings the changelog up-to-date with the 3.2.0 milestone at the
date of commit.
2021-02-16 22:29:48 +08:00
ridiculousfish
c35535dee7 Do not show the history variable in fish_config
The history variable may be so large that it hangs the browser, as
spotted in #7714. Omit this from the variable list.
2021-02-15 10:47:13 -08:00
David Adam
d5ac8a01b6 CHANGELOG: work on 3.2.0 2021-02-13 22:41:11 +08:00
Johannes Altmanninger
5e8a248758 Indent escaped newlines
Similar to what fish_indent does. After typing "echo \" and hitting return,
the cursor will be indented.

A possible annoyance is that when you have multiple indented lines

	echo 1 \
	    2 \
	    3 \
	    4 \

If you remove lines in the middle with Control-k, the lines below
the deleted one will start jumping around, as they are disconnected
from and reconnected to "echo".
2021-02-13 09:01:41 +01:00
Johannes Altmanninger
fffcdf8792 Highlight redirection target as valid if it contains a to-be-defined variable
If a variable is undefined, but it looks like it will be defined by the
current command line, assume the user knows what they are doing.
This should cover most real-world occurrences.

Closes #6654
2021-02-13 08:59:54 +01:00
Johannes Altmanninger
4c1173f2ae fish_clipboard_paste: trim indentation when pasting multiple lines
When pasting a multiline command with indented blocks, extra indentation
from spaces, or tabs, is generally undesirable, because fish already indents
pipes and blocks. Discard the indentation unless the cursor or the pasted
part is inside quotes.

Users who copied fish_clipboard_paste need to update it because
__fish_commandline_is_singlequoted had an API change and was renamed.
2021-02-13 08:55:59 +01:00
Ethel Morgan
5a0aa7824f Saturate exit codes to 255 for all builtins
After commit 6dd6a57c60, 3 remaining
builtins were affected by uint8_t overflow: `exit`, `return`, and
`functions --query`.

This commit:
- Moves the overflow check from `builtin_set_query` to `builtin_run`.
- Removes a conflicting int -> uint8_t conversion in `builtin_return`.
- Adds tests for the 3 remaining affected builtins.
- Simplifies the wording for the documentation for `set --query`.
- Does not change documentation for `functions --query`, because it does
  not state the exit code in its API.
- Updates the CHANGELOG to reflect the change to all builtins.
2021-02-13 08:41:51 +01:00
Johannes Altmanninger
e27d97b02e Do not add spaces after completions ending in "-"
Some programs use this to separate things in a word, see
https://github.com/spf13/cobra/pull/1249#discussion_r563605048

Require the token to be at least length 2 for the no-space behavior,
for completions of "-" like for python.
2021-02-13 08:13:31 +01:00
ridiculousfish
84d59accfc builtins to allow stdin to be closed
Prior to this fix, if stdin were explicitly closed, then builtins would
silently fail. For example:

    count <&-

would just fail with status 1. Remove this limitation and allow each
builtin to handle a closed stdin how it sees fit.
2021-02-10 17:43:10 -08:00
Ethel Morgan
6dd6a57c60 Saturate return value in builtin_set_query
builtin_set_query returns the number of missing variables. Because the
return value passed to the shell is an 8-bit unsigned integer, if the
number of missing variables is a multiple of 256, it would overflow to 0.

This commit saturates the return value at 255 if there are more than 255
missing variables.
2021-02-08 20:38:56 +01:00
Fabian Homborg
42c75111c8 CHANGELOG: Fix code inside bold blocks
Sphinx doesn't like it, so either use normal quotes or put the code
outside of the bold block.
2021-02-08 17:18:53 +01:00
Michael Jarvis
84a89f5195 Fix sphinx warning
[100%] Building HTML documentation with Sphinx
../CHANGELOG.rst:48: WARNING: Document or section may not begin with a transition.
../CHANGELOG.rst:48: WARNING: Document or section may not begin with a transition.
2021-02-08 17:16:40 +01:00
Johannes Altmanninger
e487f193b8 CHANGELOG: add headers for fish-next-minor 2021-02-08 07:31:33 +01:00
Fabian Homborg
48b3b826aa CHANGELOG fish_color_keyword 2021-02-07 21:20:34 +01:00
Mahmoud Al-Qudsi
1651db23fe Update CHANGELOG to add issue 4873 to 3.2.0 release 2021-02-07 10:36:38 -06:00
David Adam
c633ce7e76 CHANGELOG: work on 3.2.0 2021-02-07 22:14:03 +08:00
Shun Sakai
9147a30926 Update CHANGELOG 2021-02-05 12:25:04 +01:00
Shun Sakai
4d48720d6a Update CHANGELOG 2021-02-05 12:24:23 +01:00
Johannes Altmanninger
29ee4d318d Do use autogenerated completions for external git subcommands
Some third party Git tools provide a man page, which we can at least use
for completing options.

The old logic excluded all generated completions for Git subcommands.
Instead, try to load completions for all available external subcommands.
We can use $PATH/git-* because /bin/git-add and friends were removed in Git
1.6.0 in 2008.

Closes #4358 (the "git-foo" wrapping was added in #7652)
2021-02-02 07:54:28 +01:00
Fabian Homborg
b8920d493f CHANGELOG: Add userdbctl completions, put systemd stuff together 2021-01-30 19:03:31 +01:00
Fabian Homborg
261e13e0ca CHANGELOG --profile-startup
See #7648
2021-01-29 20:48:13 +01:00
Fabian Homborg
f78cbf79fc CHANGELOG: Make the important bits bold
Nicked from the old (old old old) changelog for fishfish Beta r1
2021-01-26 14:36:43 +01:00
Johannes Altmanninger
09161761c1 Complete custom "git-foo" commands from "git foo"
Since #7075, git-foo.fish files are sourced when Git completions are loaded.
However, at least Cobra (CLI framework for Go) provides completions like

	complete git-foo ...

This means that completions are only offered when typing "git-foo <TAB>"
and not on "git foo <TAB>". Fix this by forwarding the completion requests.
Take care to only forward if there are actually completions for "git-foo",
to avoid adding filename completions.
2021-01-25 19:09:56 +01:00
Fabian Homborg
2109817861 MOAR CHANGELOG 2021-01-22 16:51:46 +01:00
Fabian Homborg
435021e8c2 CHANGELOG 4: Possibly too much changelog edition
Some reformatting and showing an example for the prompt truncation, mainly
2021-01-21 19:07:38 +01:00
Fabian Homborg
392fb490b0 CHANGELOG 3: Return Of The Changelog 2021-01-20 21:30:50 +01:00
Fabian Homborg
7265d3763f CHANGELOG: Even moar 2021-01-20 19:53:53 +01:00
Fabian Homborg
5d8761dc31 CHANGELOG: Work on 3.2.0 2021-01-20 17:57:09 +01:00
Fabian Homborg
c5379aaf2d CHANGELOG Add 7638 2021-01-19 19:02:58 +01:00
Fabian Homborg
89962da059 CHANGELOG: More 3.2.0 2021-01-19 13:45:00 +01:00
David Adam
d0167634e7 CHANGELOG: work on 3.2.0 2021-01-13 21:52:31 +08:00
ridiculousfish
7a0bddfcfa Teach string repeat to handle multiple arguments
Each argument in string repeat is handled independently, except that the
--no-newline option applies only to the last newline.

Fixes #5988
2021-01-11 17:00:06 -08:00
Fabian Homborg
19efd22468 env: Setup $HOME/$USER *before* the config directories
They are based on $HOME, so setting $HOME has to be done first.

Fixes #7620

(untested because I'm assuming common CI systems have weird $HOME settings)
2021-01-11 18:51:47 +01:00
Fabian Homborg
f22fe44c79 CHANGELOG 7614 2021-01-09 12:13:24 +01:00
Fabian Homborg
bc2612da18 CHANGELOG: Some more work of un-issued commits
We should really start just adding these to the changelog sooner.
2021-01-08 18:34:49 +01:00
David Adam
6d1eab9364 CHANGELOG: fix some Markdown to reStructuredText nits 2021-01-08 22:22:43 +08:00
David Adam
9af5b33a6d CHANGELOG: work on 3.2.0 2021-01-08 22:12:13 +08:00
David Adam
21f46181d9 string match: reword the named capture group documentation 2021-01-08 21:16:07 +08:00
David Adam
fb873f2e98 CHANGELOG: work on 3.2.0 2021-01-07 22:17:04 +08:00
Fabian Homborg
cb3ee51e08 CHANGELOG cgi removal 2021-01-03 15:18:15 +01:00
Ilan Cosman
18940ea086
Remove dunderscores from __fish_status_to_signal (#7597)
* Remove dunderscores from __fish_status_to_signal

* Document fish_status_to_signal

* CHANGELOG: Add fish_status_to_signal

* Add string join to fish_status_to_signal documentation example
2021-01-03 15:15:57 +01:00
ridiculousfish
29121ffc4c Relnote fixes for #7589 and #1383 2021-01-02 22:18:14 -08:00
David Adam
ab5608ddf2 CHANGELOG: work on 3.2.0 2021-01-02 23:26:58 +08:00
Fabian Homborg
eb43fc83c5 CHANGELOG: Add that numbered debugging is no more 2021-01-01 20:47:23 +01:00
Fabian Homborg
8a585bb711 Also disable winch handling in alacritty
It also reflows.

We might want to think about doing something more extensible here, as
konsole is also about to add reflow, but for now the main problem
children here are VTE and alacritty.

Extends #7491.
2021-01-01 20:22:57 +01:00
Fabian Homborg
364692fa3d CHANGELOG: MOAR 2021-01-01 18:38:20 +01:00