Commit Graph

13972 Commits

Author SHA1 Message Date
Ilan Cosman
bcbfd70d41
Create empty directories and files on interactive startup (#7796)
Closes #7402
2021-03-23 21:01:00 +01:00
Johannes Altmanninger
76af09a507 Give tmux tests more slack
They never fail me locally, but I saw two failures in GitHub Actions
in the past days (regular builds, not just TSan).
2021-03-23 20:54:23 +01:00
Karolina Gontarek
a0f05b376e
Shorten completions for vbc and pydf (#7859) 2021-03-23 20:46:42 +01:00
Jannik Vieten
0f3274d5eb
Fix completion errors for tshark when running as root (#7858) 2021-03-23 20:40:44 +01:00
Mahmoud Al-Qudsi
c55865f76e Change use of tmux's resize-window to resize-pane
I believe they are both equivalent for our particular purpose, since we
only care about enforcing the size fish sees.

`resize-window` was only introduced in tmux 2.9, which isn't available
at least on Ubuntu 18.04 LTS (currently using tmux 2.6) and probably
many others.

(Clever idea to use tmux here!)
2021-03-23 00:39:17 -05:00
Fabian Homborg
7f7cfcf339 Only donate term if we're interactive *and* have the terminal
As it turns out otherwise fish would hang when sddm starts it as the login shell.

Belongs to #7842.
2021-03-22 17:00:43 +01:00
ridiculousfish
66a873ad23 Relnote fix for 7837 2021-03-21 16:59:22 -07:00
ridiculousfish
8d54d2b60e Skip long arguments in syntax highlighting path detection
When fish performs syntax highlighting, it attempts to determine which
arguments are valid paths and underline them. Skip paths whose length
exceeds PATH_MAX. This is an optimization: such strings are almost
certainly not valid paths and checking them may be expensive.

Relevant is #7837
2021-03-21 16:59:22 -07:00
ridiculousfish
cf35431af9 Reimplement wbasename and wdirname
Previously wbasename and wdirname wrapped the system-provided basename
and dirname. But these have thread-safety issues and some surprising
error conditions on Mac. Just reimplement these per the OpenGroup spec.

In particular these no longer trigger a null-dereference if the input
exceeds PATH_MAX.

Add some tests too.

This fixes #7837
2021-03-21 16:33:04 -07:00
ridiculousfish
6e1b324343 Add some tests for dirname and basename
This is in preparation for replacing our wrappers around the C versions,
with custom versions instead.
2021-03-21 16:32:58 -07:00
ridiculousfish
a7c37e4af4 Don't block certain error signals on background threads
Previously fish attempted to block all signals on background threads, so
that they would be delivered to the main thread. But on Mac, SIGSEGV
and probably some others just get silently dropped, leading to potential
infinite loops instead of crashing. So stop blocking these signals.

With this change the null-deref in #7837 will properly crash instead of
spinning.
2021-03-21 16:32:45 -07:00
ridiculousfish
43cc99e1ba Group certain cmake targets into folders
This makes folders in IDEs for certain Mac and gettext targets, reducing
the number of targets which appear at top-level.
2021-03-21 13:29:41 -07:00
ridiculousfish
1b950f5f3b Switch fish.pc dependency from FBVF file to CHECK-FBVF target
Previously, both fish.pc and libfish had generating the
FISH-BUILD-VERSION-FILE attached as a command. In principle they could
both try to run the command simultaneously and now CMake complains about
this with the Xcode generator.

Switch to having fish.pc depend on the CHECK-FISH-BUILD-VERSION-FILE as a
target instead of a command. This allows it to participate in dependency
resolution and CMake will succeed again.

Fixes #7838
2021-03-21 12:39:24 -07:00
Johannes Altmanninger
206543c55b fixup! Pass some parameters by reference/move 2021-03-21 19:46:49 +01:00
Johannes Altmanninger
508044bce1 Pass some parameters by reference/move 2021-03-21 19:41:36 +01:00
Johannes Altmanninger
516a70d9cb Misc cleanups
Some as suggested by lgtm.com
2021-03-21 19:41:36 +01:00
Fabian Homborg
1018cb2a81 echo: Buffer output and write it in one go
`streams.out.push_back` for fd_streams_t writes to the
fd *immediately*. We might want to introduce a general buffering
strategy, but in this case writing it in one go is the simplest and
seems acceptable - we already have constrained the argument size, so
just pushing it out should work well enough.

See #7836
2021-03-21 17:49:22 +01:00
Fabian Homborg
e4fd664bbb Only set modes after config.fish if we're *interactive*
013a563ed0 made it so we only try to
adjust terminal modes if we are in the terminal pgroup, but that's not
enough.

Fish starts background jobs in events inside its own pgroup, so

    function on-foo --on-event foo
        fish -c 'sleep 3' &
    end

would have the backgrounded fish try to fiddle with the terminal and
succeed.

Instead, only fiddle with the terminal if we're interactive (this
should probably be extended to other bits, but this is the particular
problematic part)

Fixes #7842.
2021-03-21 10:43:47 +01:00
Fabian Homborg
95dc821a44 Disable pacman command-not-found handler
Apparently it's too slow on some systems

Fixes #7841.
2021-03-21 10:03:53 +01:00
Fabian Homborg
56135a3231 Test string replace transforms
Just to make sure it works everywhere.
2021-03-21 10:03:35 +01:00
Karolina Gontarek
e4eaca1032
Fix wrapping for cd (#7843) 2021-03-21 09:27:19 +01:00
Karolina Gontarek
dcc1659266 Fix typo 2021-03-21 09:26:38 +01:00
Johannes Altmanninger
7fea321b3e
Use the correct case in completion pager (#7744)
Consider

	$ complete -c foo -a 'aab aaB' -f
	$ foo A<TAB>

since 28d67c8 we would insert the common prefix AND show the pager.
Due to case-insensitive comparison, "b/B" was considered to be part
of the prefix. Since the prefix is added to each pager item [1]
we get wrong results. Fix this by removing the insensitive comparison
between completions - I don't think it was of much use anyway.
Commandline tokens are still matched case-insensitively, this is
just about completions.

Test this by running interactive fish inside tmux (pexpect's terminal
emulation not have enough capabilities).  Also add tests for recent
interactive regressions #7526 and #7738.

Closes #3978

[1]: b38a23a would solve this differently by giving every pager item
its own prefix, but was reverted since it needs more fixes.
2021-03-21 09:25:29 +01:00
Olivier FAURE
211f8bc894
Write new completion file for cargo (#7839) 2021-03-20 21:44:38 +01:00
exploide
5eadee61c5 improved SSH completions
- use __fish_complete_ssh also for sftp
- removed old options -1 and -2
- added several newer options
- cleaned up and sorted completion code
2021-03-20 21:17:53 +01:00
Fabian Homborg
d79f864072 Add a note for help thing to the missing doc error message
This should cover most cases - the user didn't install the docs and is
trying to view the man page via __fish_print_help, so we don't have a
way to show anything.

But `help thing` will fall back to the online version of the docs,
which should work if there's an internet connection.

See #7824.
2021-03-19 17:39:36 +01:00
Fabian Homborg
02699d1acc Reject empty variable names
This allowed `set "" foo`, which is bogus and results in an unusable variable.
2021-03-18 19:36:57 +01:00
David Adam
c2eef7c250 CHANGELOG: add separator (minor formatting fix) 2021-03-18 12:36:48 +08:00
David Adam
7b53547dcd .desktop file: drop deprecated key
Recommended by @ZanderBrown in
eb7172458b (commitcomment-48302972)
2021-03-18 12:36:18 +08:00
David Adam
23f613723f Merge branch 'Integration_3.2.1' 2021-03-18 12:23:06 +08:00
David Adam
156d57d270 Release 3.2.1
Closes #7772.
2021-03-18 11:05:28 +08:00
David Adam
a1653c928e CHANGELOG: work on 3.2.1 2021-03-17 21:51:02 +08:00
David Adam
0988d2fc15 Merge branch 'master' into Integration_3.2.1 2021-03-16 18:00:36 +08:00
Johannes Altmanninger
efcfec0ba1 fixup! Show an error when "builtin -h" fails to find a man page 2021-03-15 23:14:17 +01:00
Johannes Altmanninger
f9e131aa93 Show an error when "builtin -h" fails to find a man page
Prior to this commit "builtin -h" would silently fail when no
documentation is installed. This happens when running fish without
installing it, or when the docs are not installed.

See #7824
2021-03-15 23:07:08 +01:00
Johannes Altmanninger
582675c96a completions/git: restore forward-compatibility by using "complete -c"
After a fish installation is upgraded to 3.2.0, active shells could
throw an error attempting to load Git completions. It's just a
transient error but also easily avoidable by using the old style.

See #7822
2021-03-15 22:34:30 +01:00
lapingenieur
f95f12f5e7 changed 'rm' to 'command rm'
if rm is aliased to 'rm -i' then rm will ask to delete the cache file after funced edited the file which is anoying
2021-03-15 21:07:39 +01:00
exploide
38cd373ca3 added completions for mkpasswd 2021-03-14 16:46:38 -07:00
lapingenieur
dfd1e3a362 Added a ':' at the end of a french translation 2021-03-14 21:13:27 +01:00
Fabian Homborg
771db6018e Revert "fish.spec: drop RHEL 6 elements"
The 3.2 branch still supports it

This reverts commit 63fa8dfd26.
2021-03-14 12:56:16 +01:00
Johannes Altmanninger
865abebd11 Simplify highlight tests by changing into dedicated test dir 2021-03-13 17:51:49 +01:00
Fabian Homborg
29ebd4a5ff tests: Don't break when a file unexpectedly exists
Creating a file called "xfoo" could break the highlight tests because
we'd suddenly get a color with valid_path set to true.

So what we do is simply compare foreground/background and forced
underline, but only check for path validity if we're expecting a valid
path.

If we're not expecting a valid path, we don't fail whether it is there
or not.

This means that we can't check for a non-valid path, but we don't
currently do that anyway and we can just burn that bridge when we get
to it.

cc @siteshwar @krobelus, who both came across this
2021-03-13 17:25:23 +01:00
Fabian Homborg
3c3bf7ffd7 completions/git: Show recent commits *on all branches* for rebase
Doesn't make a ton of sense for the current branch
2021-03-12 18:12:03 +01:00
Fabian Homborg
873d7f6bb3 completions/git: Add recent commits for rebase
Fixes #7817
2021-03-12 18:10:11 +01:00
Fabian Homborg
018f1f7e20 docs: Document the math functions better 2021-03-11 19:46:52 +01:00
Ilya Grigoriev
1a03c23b58 Improve error when help fails to find a browser
Previously, this message told the user to "set $BROWSER and try again". However,
when I first saw this error, I didn't know how I can set `BROWSER` in fish. Moreover,
I often see this error in situations when no browser will work. For instance, I might be
using fish over ssh, and I might either not know whether that system has a text-mode
browser installed or not want to use it.

A further improvement would be to report this message if a browser fails to start.
2021-03-11 18:32:24 +01:00
Fabian Homborg
c23f311956 pythonista prompt: Remove single-argument test 2021-03-11 16:55:17 +01:00
ridiculousfish
9ab77c7ddc Relnote fix for #7770 2021-03-10 22:50:57 -08:00
ridiculousfish
3cb105adbd Restore terminal modes after running key bindings with external commands
This concerns the behavior when running an external command from a key
binding. The history is:

Prior to 5f16a299a7, fish would run these external commands in shell
modes. This meant that fish would pick up any tty changes from external
commands (see #2114).

After 5f16a299a7, fish would save and restore its shell modes around
these external commands. This introduced a regression where anything the
user typed while a bound external command was executing would be echoed,
because external command mode has ECHO set in c_lflag. (This can be
reproed easily with `bind -q 'sleep 1'` and then pressing q and typing).
So 5f16a299a7 was reverted in fd9355966.

This commit partially reverts fd9355966. It has it both ways: external
commands are launched with shell modes, but/and shell modes are restored
after the external command completes. This allows commands to muck with
the tty, as long as they can handle getting shell modes; but it does not
enable ECHO mode so it fixes the regression found in #7770.

Fixes #7770. Fixes #2114 (for the third time!)

This partially reverts commit fd9355966e.
2021-03-10 22:36:33 -08:00
ridiculousfish
7e8b8345e7 Fix some graphical glitches in fish_config
fish_config has some shadows and other elements which don't align
propertly. Fix these, and apply some other miscellaneous polish.

Fixes #7811
2021-03-10 18:46:06 -08:00