Commit Graph

15625 Commits

Author SHA1 Message Date
ridiculousfish
df2cbe321c Refactor tty transfer to be more deliberate
This is a big cleanup to how tty transfer works. Recall that when job
control is active, we transfer the tty to jobs via tcsetpgrp().

Previously, transferring was done "as needed" in continue_job. That is, if
we are running a job, and the job wants the terminal and does not have it,
we will transfer the tty at that point.

This got pretty weird when running mixed pipelines. For example:

    cmd1 | func1 | cmd2

Here we would run `func1` before calling continue_job. Thus the tty
would be transferred by the nested function invocation, and also restored
by that invocation, potentially racing with tty manipulation from cmd1 or
cmd2.

In the new model, migrate the tty transfer responsibility outside of
continue_job. The caller of continue_job is then responsible for setting up
the tty. There's two places where this gets done:

1. In `exec_job`, where we run a job for the first time.

2. In `builtin_fg` where we continue a stopped job in the foreground.

Fixes #8699
2022-03-19 14:48:36 -07:00
ridiculousfish
3f585cddfc Refactor job pgroup assignment
This is a cleanup of job groups, rationalizing a bunch of stuff. Some
notable changes (none user-visible hopefully):

1. Previously, if a job group wanted a pgid, then we would assign it to the
   first process to run in the job group. Now we deliberately mark which
   process will own the pgroup, via a new `leads_pgrp` flag in process_t. This
   eliminates a source of ambiguity.

2. Previously, if a job were run inside fish's pgroup, we would set fish's
   pgroup as the group of the job. But this meant we had to check if the job
   had fish's pgroup in lots of places, for example when calling tcsetpgrp.
   Now a job group only has a pgrp if that pgrp is external (i.e. the job is
   under job control).
2022-03-19 14:06:18 -07:00
Matti Viljanen
5994e44877 Fix launching fish_config on SailfishOS 2022-03-18 15:56:22 +01:00
Fabian Homborg
0bc6a7b2ed
Make --no-config mode more comfortable (#8493)
* Turn on default bindings for --no-config mode

The fallback bindings are super awkward to use.

This was called out specifically in #7921, I'm going for the targeted
fix for now.

* Only change keybindings when interactive

That's also when we'd source them normally.
2022-03-17 19:02:12 +01:00
Fabian Homborg
7935b7327e CHANGELOG 2022-03-17 18:21:43 +01:00
Fabian Homborg
666032abbd Translate command-not-found message
I have no idea why this function is defined twice.
2022-03-17 18:19:03 +01:00
pagedown
47294f4d29 Add kitty to __update_cwd_osc 2022-03-17 18:17:42 +01:00
Evan Benn
f7faf0fcf7 Reorder git checkout completions
Multiple complete -k -a arguments are ordered last first. Reorder the
completions to list branches first, then tags and then finally commits.
2022-03-17 18:15:44 +01:00
Fabian Homborg
fb283cfe4a Move $__fish_initialized to config_interactive
This is no longer used in share/config.fish, and it's quite cheesy.

The only thing we use it for is defaulting the colorscheme.
2022-03-17 18:15:11 +01:00
Fabian Homborg
49c16cc9a6 Stop migrating old abbrs
This tried migrating old abbreviations *twice* - once from the 2.3
scheme to the 2.4 one, and once from that to the 3.0 scheme.

Since this is purely for upgrading from fishes < 3.0, and basically
untested, let's remove it.

If anyone does that upgrade, they'll simply have to reexecute the abbrs.
2022-03-17 18:15:11 +01:00
Fabian Homborg
d751b00504 Remove getifaddrs check
Not used anymore
2022-03-17 18:15:11 +01:00
Fabian Homborg
ef28931293 Stop migrating legacy uvar paths
These were changed in fish 3.0 in December 2018.

This means upgrading from fish 2.7.1 or earlier to the next fish
version will require users to set their universal variable again.
2022-03-17 18:15:11 +01:00
Fabian Homborg
a7b80c9881 Remove misleading comment 2022-03-17 18:15:11 +01:00
Fabian Homborg
03c188086c Remove wcsndup and wcslcpy
We no longer use these anywhere.
2022-03-17 18:15:11 +01:00
Fabian Homborg
753f29df4c Stringify reformat_for_screen
This is the only usage of wcsndup, and we can just use wcstring::substr.
2022-03-17 18:15:11 +01:00
Fabian Homborg
71cfd25c1d Command-not-found: Warn if a file exists but isn't executable
This simply adds a nice error so you can better see if your command
isn't available because it's not executable.

Fixes #8804.
2022-03-17 18:06:36 +01:00
Edward Betts
dc4e88d7b4 Fix a typo 2022-03-16 20:02:09 -07:00
AJ
fd84e07320 completions: fix long tmutil.fish descriptions #6981
Reduce `tmutil.fish: tmutil -n __fish_use_subcommand -a localsnapshot -d` to 66 characters.
2022-03-16 20:29:00 +01:00
AJ
fcfa72e5fc Update mix.fish
Update `mix.fish` autocomplete to shorter description (60 characters). Addresses `mix.fish` Issue #6981
2022-03-16 20:28:27 +01:00
Fabian Homborg
2f7a73381a CHANGELOG 2022-03-16 20:16:05 +01:00
Fabian Homborg
534646f9d3 read: Actually only fire fish_read, not fish_prompt event
Fixes #8797.
2022-03-16 20:14:59 +01:00
Fabian Homborg
4e2ce0af4e pwd: Add newline to error message
This would keep the cursor on the same line, which is annoying.
2022-03-16 19:20:58 +01:00
aj
d2225e5ce7 remove heroku-two-factor as it is deprecated per: https://github.com/heroku/heroku-two-factor
update complete $heroku_looking -xa git:clone to make it as short as possible without losing meaning.
2022-03-15 19:19:49 +01:00
Fabian Homborg
d34ebe94ca CHANGELOG 2022-03-15 17:39:44 +01:00
Radu Potop
2884b27367
Astronaut prompt theme (#8775)
* Added initial commit for the Starfish prompt theme

* Respect cwd colors

* Corrected typo

* Renamed theme to Astronaut

* Fixed cwd_color for root

* Allow longer dir names, fix variable setting
2022-03-15 17:06:00 +01:00
Missu
30dcd18afb
Add completion for tuned-adm (#8760)
* Add completion for `tuned-adm`

This is part of `tuned` package

* Update tuned-adm.fish
2022-03-15 17:05:06 +01:00
Missu
280727073a
Add completion for brightnessctl (#8758)
* Add completion for `brightnessctl`

* Update brightnessctl.fish
2022-03-15 17:04:31 +01:00
Fabian Homborg
07543ff881 Use old-school "()" command substitution in fish_title
Because we reload changed function files, a common issue on upgrading
to 3.4.0 is that fish_title causes errors.

So we simply use the oldschool syntax.

(cherry picked from commit c5a8764db1)
2022-03-14 18:16:37 +01:00
Fabian Homborg
0314cb662f Fix build on NetBSD
This missed a change to "dir_remoteness_t" from bool

Fixes #8788

(cherry picked from commit 695e20c47f)
2022-03-14 18:16:20 +01:00
Fabian Homborg
8c13f5894b Fix tparm kludge
This just defines a constant to whichever tparm implementation we're
using (either the actual, working one the system provides, or our
kludge to paper over Solaris' inadequacies).

This means that there won't be so much ping-ponging of what "tparm"
stands for. "tparm" is the system's function. Only we don't use it,
just like we don't use wcstod directly.

Fixes #8780

(cherry picked from commit a76ed9942d)
2022-03-14 18:16:20 +01:00
Fabian Homborg
c5a8764db1 Use old-school "()" command substitution in fish_title
Because we reload changed function files, a common issue on upgrading
to 3.4.0 is that fish_title causes errors.

So we simply use the oldschool syntax.
2022-03-14 18:15:06 +01:00
Fabian Homborg
695e20c47f Fix build on NetBSD
This missed a change to "dir_remoteness_t" from bool

Fixes #8788
2022-03-14 18:13:39 +01:00
Fabian Homborg
a76ed9942d Fix tparm kludge
This just defines a constant to whichever tparm implementation we're
using (either the actual, working one the system provides, or our
kludge to paper over Solaris' inadequacies).

This means that there won't be so much ping-ponging of what "tparm"
stands for. "tparm" is the system's function. Only we don't use it,
just like we don't use wcstod directly.

Fixes #8780
2022-03-14 15:36:17 +01:00
Fabian Homborg
cd62771d12 read: Don't use chunking read with --line
Fixes a regression from #8552.
2022-03-14 08:04:35 +01:00
Andrey Mishchenko
dc5bdda8e0 Remove underscores-in-math-builtin entry from 3.4 changelog 2022-03-13 19:24:54 +01:00
Fabian Homborg
97127c3e03 CHANGELOG 2022-03-13 11:49:39 +01:00
Fabian Homborg
8bcb034422 Disable tmux-history-search test on GH Actions 2022-03-13 11:48:52 +01:00
joao-vitor-sr
4ae4ea0169
New -n flag for string join. (#8774)
* New -n flag for string join command.

This is an argument that excludes empty result items. Fixes #8351

* New documentation for string-join.

The new argument --no-empty was added at string-join manpage.

* New completions for the new -n flag for string join.

* Remove the documentation of the new -n flag of string join0

The reason to remove this new argument in the join0 is that this flag basically doesn't make any difference in the join0.

* Refactor the validation for the string join.

The string join command was using the length of the argument, this commit changes the validation to use the empty function.

* Revert #4b56ab452

The reason for the revert is thath the build broke on the ubuntu in the Github actions.

* Revert #e72e239a1

The reason the compilation on GitHub broke is that the test was weird, it didn't even run it, Common CI systems are typically very very resource-constrained.

* Resolve conflicts in the string-join.rst.

* Resolve conflicts in the "string-join.rst".

commit #1242d0fd7 not fixed all conflicts.
2022-03-13 11:47:33 +01:00
Fabian Homborg
ffdbc5a1b2 CHANGELOG 2022-03-13 11:41:38 +01:00
Fabian Homborg
a7859191b2 Remove is_color_escape_seq
This is supposed to detect color escape sequences, to figure out how
long an escape sequence is, for use in width calculations.

However, the typical color sequences are already taken care of by
is_csi_style_escape_seq because they look like a csi sequence starting
with `\e[` and ending in `m`.

In the entire terminfo database shipped with ncurses 6.3, these are
the terminals that have non-csi color sequences:

at-color
atari-color
atari_st-color
d220-dg
d230-dg
d230c-dg
d430-dg
d430-unix
d430-unix-25
d430-unix-s
d430-unix-sr
d430-unix-w
d430c-dg
d430c-unix
d430c-unix-25
d430c-unix-s
d430c-unix-sr
d430c-unix-w
d470-dg
d470c-dg
dg+fixed
dgmode+color
dgmode+color8
dgunix+fixed
emu
fbterm
i3164
ibm3164
linux-m1b
linux-m2
minitel1
minitel1b
putty-m1b
putty-m2
st52-color
tt52
tw52
tw52-color
xterm-8bit

Most of these were discontinued in the 90s and their manufacturers no
longer exist (like Data General, which went defunct in 1999). The last one is a special mode for xterm that is
fundamentally UTF-8 incompatible because it encodes a CSI as \X9b.

The linux/putty m1b and m2 entries (also for minitel) don't support
color to begin with and the sequences they have in their terminfo
entries are control characters anyway, so the calculation would still
add up.

In turn, what we gain from this is much faster width calculations with
unrecognized escapes -
e.g. `string length -V \efoo` is sped up by a factor of 20.

An alternative would be to skip this if max_colors is > 16 as that is
the most any of these entries can do. The runtime scales linearly with
the number of colors so on those systems it would be reasonably quick anyway.

But given just *how* outdated these are I believe it is okay to just
remove support outright. I do not believe anyone has ever run fish on
any of these.
2022-03-13 11:32:53 +01:00
Fabian Homborg
ba8cbf877f
Merge pull request #8646 from juntuu/te-refactor
Variadic functions for `math` and tinyexpr rewrite.
2022-03-13 11:32:32 +01:00
Fabian Homborg
972752aa1c
Merge branch 'master' into te-refactor 2022-03-13 11:24:31 +01:00
Andrey Mishchenko
59e50f77bc
Allow underscores as separators in the math builtin (#8611)
* Implement fish_wcstod_underscores

* Add fish_wcstod_underscores unit tests

* Switch to using fish_wcstod_underscores in tinyexpr

* Add tests for math builtin underscore separator functionality

* Add documentation for underscore separators for math builtin

* Add a changelog entry for underscore numeric separators
2022-03-13 11:23:35 +01:00
Fabian Homborg
9ada7d9aad read: Also read in chunks when directly redirected
We can't always read in chunks because we often can't bear to
overread:

```fish
echo foo\nbar | begin
    read -l foo
    read -l bar
end
```

needs to have the first read read `foo` and the second read `bar`. So
here we can only read one byte at a time.

However, when we are directly redirected:

```fish
echo foo | read foo
```

we can, because the data is only for us anyway. The stream will be
closed after, so anything not read just goes away. Nobody else is
there to read.

This dramatically speeds up `read` of long lines through a pipe. How
much depends on the length of the line.

With lines of 5000 characters it's about 15x, with lines of 50
characters about 2x, lines of 5 characters about 1.07x.

See #8542.
2022-03-13 11:22:48 +01:00
Fabian Homborg
a0e639e1fa read: Remove super old TODO
This was never a problem. If we need it, it's in the git log
2022-03-13 11:22:48 +01:00
Fabian Homborg
9172ab5983
Merge pull request #8473 from krobelus/string-preserve-missing-newline
builtin string: don't print final newline if it's missing from stdin
2022-03-13 11:22:18 +01:00
Fabian Homborg
585d1de653
Merge branch 'master' into string-preserve-missing-newline 2022-03-13 11:21:53 +01:00
David Adam
c7e4350ab6 Release 3.4.0
Fixes #8092.
2022-03-12 22:30:41 +08:00
David Adam
c6d68b4593 CHANGELOG: work on 3.4.0 2022-03-12 22:28:54 +08:00
Ilan Cosman
1edb642abe Ignore own PR 2022-03-12 22:25:33 +08:00