Commit Graph

15114 Commits

Author SHA1 Message Date
Johannes Altmanninger
4a575b26f5 Fix error check for repeated quoted command substitution
Commit e40eba358 (Treat text following quoted command substitution
as quoted) made parse_util_locate_cmdsubst_range() aware of quoted
command substitutions, by skipping surrounding text via quote_end().

However, it was not quite right. We fail to properly parse
two consecutive command substitutions in the same string,
because we don't maintain the quoting context across calls to
parse_util_locate_cmdsubst_range().  Let's track that bit in a
parameter. This allows us to get rid of the quote_end() hack.

Also apply this to the other place where we call
parse_util_locate_cmdsubst_range() in a loop (highlighting).

Fixes #8500
2021-12-04 16:56:07 +01:00
Johannes Altmanninger
c706b1d6cb Reword confusing comments about quoted cmdsub tokenization 2021-12-04 16:52:13 +01:00
Johannes Altmanninger
b5739ddacf Report sub-token error locations again
This fixes a regression about where we report errors:

	echo error(here
	old: ^
	   fixed: ^

Commit 0c22f67bd (Remove the old parser bits, 2020-07-02) removed
uses of "error_offset_within_token" so we always report errors at
token start. Add it back, hopefully restoring the 3.1.2 behavior.

Note that for cases like

	echo "$("

we report "unbalanced quotes" because we treat the $( as double
quote.  Giving a better error seems hard because of the ambguity -
we don't know if quote is meant to be inside or outside the command
substitution.
2021-12-04 16:52:13 +01:00
Johannes Altmanninger
594c23181f Changelog for completion pager fix on multiline command (#8509) 2021-12-04 16:52:13 +01:00
Kid
bacd47f35f Add completion for Starship 2021-12-04 10:38:14 +01:00
Andrey Mishchenko
e79617f4b7 Add documentation for prompt_hostname 2021-12-04 10:37:49 +01:00
Andrey Mishchenko
bea86f04c7 Lowercase command description for consistency 2021-12-04 10:37:49 +01:00
Andrey Mishchenko
7f4b71e533 Delete trailing whitespace 2021-12-04 10:37:49 +01:00
Emily Grace Seville
04de5b1fec
/define option for pabcnetcclear completion (#8526)
* Add /define option

* Fix PascalABC.NET version
2021-12-04 10:32:40 +01:00
Andrey Mishchenko
a3bf41223e Reword documentation for filename in man status 2021-12-04 10:32:15 +01:00
Alexander Sieg
7d34908baa Complete cargo subcommands without description
Cargo subcommand extensions don't provide a description in `cargo --list`,
the regex used to filter this list ignored lines without a description.
This change fixes that.
2021-12-04 10:31:11 +01:00
Fabian Homborg
3700247b55 Use the full path for noshebang'd scripts
If you make a script called `foo` somewhere in $PATH, and did not give
it a shebang, this would end up calling

    sh foo

instead of

    sh /usr/bin/foo

which might not match up.

Especially if the path is e.g. `--version` or `-` that would end up
being misinterpreted *by sh*.

So instead we simply pass the actual_cmd to sh, because we need it
anyway to get it to fail to execute before.
2021-12-02 21:10:57 +01:00
Johannes Altmanninger
0c76b571c7 Fix tmux-complete test on macOS CI
For some reason, the window dimension parameters are ignored by tmux.
Not even an extra "resize-pane -x 80 -y 10" helps. So let's just drop
that assumption from our tests.
2021-12-02 15:10:13 +01:00
Aaron Gyes
124dac4781
Update main.yml 2021-12-02 05:54:29 -08:00
Aaron Gyes
9b9e2f9f87 timer.cpp: fix format specifiers and type confusion
I think the auto-all-the-things here was a making this a little
hard to follow, so replace these things that will be used in printf
with what they really are. And change the * lengths to ints.

should clear up the alerts.
2021-12-02 05:33:21 -08:00
Aaron Gyes
2b736d023f skip tmux-complete on Darwin
There's some kind of weird problem with homebrew's terminfo and
tmux, that is beyond working around AFAICT.
2021-12-02 05:09:04 -08:00
Aaron Gyes
1df7e9802f
CodeQL on master pushes
LGTM uses CodeQL and gives us green lights on PRs. This should live at https://github.com/fish-shell/fish-shell/security/code-scanning.
2021-12-02 04:23:09 -08:00
Kid
75d16c13ea Use --almost-all in la function 2021-12-02 02:22:40 -08:00
Johannes Altmanninger
0cd3ed4b84 Fix completion pager rendering when there are lines after cursor
When the completion pager fills up all lines of the screen, we subtract
from the pager size the number of lines occupied by the prompt +
command line buffer (typically 1), so the command line is always
visible.  However, we only subtract the number of lines *before* the
cursor, so on some multiline commandlines we draw a pager that is
too large for our screen, clobbering the commandline rendering.
Fix this by counting all lines.

Fixes #8509
Possibly fixes #8405
2021-12-02 04:58:46 +01:00
Johannes Altmanninger
667bedad3d Fix stale comment referencing s_write
s_write is no more since 887867201 (Switch screen.h free functions
to member functions on screen_t, 2021-09-21).
2021-12-02 04:58:46 +01:00
Fabian Homborg
be43e95ac9 docs: Expand path variable section 2021-12-01 19:03:40 +01:00
Fabian Homborg
fbac70ab38 math: For two adjacent numbers, complain about missing operator
Simply a nicer error message.
2021-12-01 16:56:18 +01:00
Fabian Homborg
24cdb896d3 Readd braces for single-line if
This is misleading, especially because it's in a section of code where
the other branches are using braces.
2021-12-01 16:47:00 +01:00
Aaron Gyes
de0cbd2984 tinyexpr: report errors for extra args in parens correctly.
Usages like `math (1 1)` should report too many arguments,
same as `math 1 1`. Check for these cases and add tests.

Fixes #8511
2021-12-01 04:49:50 -08:00
Aaron Gyes
abf119918f fkr: do not do should_exit() thing for continuous mode.
Fixes #8510.
2021-12-01 02:15:58 -08:00
Aaron Gyes
6fd988a355
Update CHANGELOG.rst
. . .
2021-12-01 02:09:28 -08:00
Fabian Homborg
39a31d273c README: Link to Unix & Linux Stackexchange instead of SO
Stackoverflow's fish tag suffers from inconsistent moderation and an
annoying policy on what is allowed and what isn't.

Given that fish straddles the line between "programming" and "usage",
some fish questions would be allowed and some wouldn't, and it is
awkward for users to tell which.

So stop recommending a site that, in practice, closes user's questions
for unclear reasons.

This needs to be done for fish-site as well.
2021-11-30 22:22:05 +01:00
David Adam
d987ab8ec4 CHANGELOG: work on 3.4.0 2021-11-30 23:06:26 +08:00
David Adam
c0fa4a6f4c README: use apt instead of apt-get
apt has a slightly nicer UI.

Fixes #8497.
2021-11-30 21:39:46 +08:00
Fabian Homborg
e2331eb034 ISSUE_TEMPLATE: Add a marker for where the text goes
We've had at least two issues where people put their text into the
comment, making it look like they filled out nothing.

The alternative is to use Github's new YAML-based system, but tbh I'm
not feeling it.
2021-11-28 15:44:10 +01:00
Fabian Homborg
a07187f46f Return proper exec error also for relative shebangs
As seen in
https://stackoverflow.com/questions/70139844/how-to-execute-custom-fish-scripts-in-custom-path-folder,
making a shebang like

   #!usr/bin/fish

won't work, and will error with the default "file does not exist"
error *pointing to the file, not the interpreter*.

Detect that interpreter properly.

We might want to make this an even more specific error, but now it
says

```
exec: Failed to execute process '/home/alfa/.local/bin/borken.fish': The file specified the interpreter 'usr/bin/fish', which is not an executable command.
```

Which is okay.
2021-11-28 14:19:01 +01:00
Fabian Homborg
29fa8b776c themes/coolbeans: Make quotes less red
This was awkward to tell from the error color, which we want to keep red.
2021-11-28 12:50:00 +01:00
Fabian Homborg
2a1d59107f prompts/disco: Remove superfluous space from git prompt 2021-11-28 12:39:22 +01:00
Aaron Gyes
605c048fc7 add dscacheutil completions
this is the thing you use on macos to reset the DNS cache.
2021-11-27 15:23:12 -08:00
ridiculousfish
54a844b08e Clean up wildcard_has
wildcard_has was a "conservative" function which would sometimes falsely
report wildcards. Make it exact and add some tests.
2021-11-27 12:48:04 -08:00
ridiculousfish
954d0fb042 Output more information in read --nchars test
To try to track down a test failure, improve the error message.
2021-11-27 11:02:03 -08:00
Collin Styles
4a3e55f69c Don't escape tildes that come from custom completions
A completion entry like «complete -a '\\~'» results in completions
that insert \~ into the command line.  However we usually want to
insert ~, but there is no way to do that.

There are a couple of longstanding issues about completion escaping
[1].  Until we fix those in a general way, fix the common case by
never escaping tildes when applying custom completions to the command
line. This is a hack but will probably work out fine because we don't
expect literal tildes in arguments.

The tilde is included in completions for cdh, or
__fish_complete_suffix, which simply forwards results from "complete
-C". Revert a workaround to cdh that expanded ~, because we can now
render that without escaping.

Closes #4570, #8441

[ja: tweak patch and commit message]

[1]: https://github.com/fish-shell/fish-shell/pull/8441#discussion_r748803338
2021-11-27 17:05:46 +01:00
Johannes Altmanninger
ef3ded1091 Changelog expanding command tokens for custom completion #8442
Not strictly an interactive feature but fits better here?
2021-11-27 17:05:46 +01:00
Fabian Homborg
772427d788 Coolbeans theme: Pick an option color
We should do this more
2021-11-27 13:36:22 +01:00
Emily Grace Seville
d7c62fa7d1
pabcnetcclear command completion update (#8480)
* Rename pabcnetcclear complete

* Code clean-up

* Debug values support

* Change /Debug description

* Standardize help

* Use single quotes for --arguments
2021-11-27 11:06:08 +01:00
Johannes Altmanninger
d1683958cf Expand tildes and variables in command for custom completions
A «complete -C '~/fish-shell/build/fish '» fails to load custom
completions because we do not expand the ~, so
complete_param_for_command() thinks that this command is invalid.
Expand command tokens before loading custom completions.

Fixes #8442
2021-11-27 10:14:13 +01:00
Fabian Homborg
5a71d02d32 Webconfig: Don't outright abort if curses can't be imported
We only need the curses module to look up sgr0, bold and underline
sequences.

Since those are going to be the xterm versions 90% of the time, we can
simply use those if this fails.

Fixes #8487.
2021-11-27 09:54:08 +01:00
EmilySeville7cfg
6f7b80e5b4 Use single quotes where possible 2021-11-26 17:42:34 -08:00
EmilySeville7cfg
4a696c1cc9 color command completion 2021-11-26 17:42:34 -08:00
Ilan Cosman
30400f3ced Use test command instead of bracket command 2021-11-26 16:55:50 -08:00
Kid
d28ddb9dc8 Call deno for completions 2021-11-26 16:16:55 -08:00
ridiculousfish
15ac74d233 Use new fish_run_tests target in Dockerfiles
This fixes the Xenial Dockerfile and perhaps others.
2021-11-26 13:19:59 -08:00
ridiculousfish
fecc022030 Rename the top-level test target to fish_run_tests
This keeps 'test' as an alias target. The reason is for compatibility
with CMake 3.10  and earlier, where one cannot make a target named
'test'.
2021-11-26 13:13:42 -08:00
Emily Grace Seville
8a3b5ca007
Add findstr completion (#8481)
* Add findstr completion

* Standardize completion

* Show completion only on Windows

* Use single quotes where possible

* Remove quotes where possible

* Remove OS check

* Use single quotes for --arguments
2021-11-26 19:30:43 +01:00
Emily Grace Seville
0697e09f14
Fix --shell option for adduser (#8479)
* Fix --shell option

* Fix

* Replace sed with string match

* Change regex pattern
2021-11-26 19:27:58 +01:00