Commit graph

14355 commits

Author SHA1 Message Date
Fabian Homborg
b3da0bd5a2 tests/noshebang: Add some longer sleeps
This still fails on launchpad. Last try, then I'm removing this - it's
not really expected that this particular bit would change a lot.
2021-05-30 17:19:04 +02:00
Fabian Homborg
8a86d3452f tests/noshebang: Do redirections in a new shell process
This is an attempt to solve the test failures on Launchpad's CI.

I'm assuming when we do a redirection like

    foo > file

and then try to execute `file` immediately afterwards, we either
haven't written it soon enough or closed the file, so we get a "text
file busy" error.

So, when we do that in a new fish the file should be closed once it
quits.

See #8021.
2021-05-30 11:08:33 +02:00
Fabian Homborg
eed2173860 docs: Stop including main css in pygments.css
This led to pydoctheme.css being included *twice*, which led to
everything it included being included twice, which was annoying in
firefox when playing with the styles.

I don't *think* it had any performance impact?
2021-05-28 20:49:57 +02:00
Fabian Homborg
470258ffd1 docs: Some rewording to the tutorial
Add a link to fish-for-bash-users, mention string collect, some reformatting
2021-05-28 20:49:57 +02:00
Fabian Homborg
21f5032a55 docs: Don't speak of "initialization files"
The file is called "config.fish", not "init.fish". We'll call it
"configuration" now.

"Initialization" might be slightly more precise, but in an irritating
way.

Also some wording improvements to the section. In particular we now
mention config.fish *early*, before the whole shebang.
2021-05-28 20:49:57 +02:00
gurudarshan266
b5d48acd7c
Condensed descriptions for various commands (#8034)
* Shorten descriptions for tmux.fish

* Shorten descriptions for bundle.fish

* Fix description in dhclient.fish
2021-05-28 18:50:01 +02:00
Fabian Homborg
cfc8d14a8d docs: Force sections to be full-width
Otherwise there's this weird *gap*, where the sections are narrow even
tho there's plenty of space?

So you have this screen layout:

```table
| sidebar | text        |
| sidebar | narr        |
| sidebar | ower        |
| sidebar | than        |
| sidebar | need        |
| sidebar | ed          |
```

For some gosh-forsaken reason.
2021-05-27 22:40:04 +02:00
Fabian Homborg
21cb791557 docs: Let the sidebar move
This means the nice navigation to other chapters always stays on
screen, instead of scrolling away.
2021-05-27 22:17:30 +02:00
Fabian Homborg
0e771590e6 docs: Remove stray mention of the IRC channel
This was apparently missed in 1f976a5041.
2021-05-27 21:41:52 +02:00
Fabian Homborg
671d820277 set_color: Print an error for unknown options
This was forgotten, so e.g. calling `set_color --bg foo` results in
nothing being printed, which might result in strings being removed - #5443.
2021-05-27 19:03:55 +02:00
Fabian Homborg
7511de8d8d tests/noshebang: Sleep before executing a file we just wrote to
When you try to execute a file directly after you've written to it,
you might, on some systems, get a "text file busy" error.

So we unfortunately have to sleep to avoid it.

See #8021 for where this was added,
537b3f6cb1 for the same problem.
2021-05-26 17:14:15 +02:00
exploide
34ededa644 updated hashcat completions to version 6.2.1 2021-05-26 13:04:36 +02:00
ridiculousfish
9820307d23 Move builtin_bind to out-of-line
There was no point in inlining this code.
2021-05-25 17:39:55 -07:00
ridiculousfish
73998b81b4 Correct the docs for commandline --current-buffer
commandline current-buffer was incorrectly documented as returning the
autosuggestion. Clarify that it does not.
2021-05-25 17:15:42 -07:00
ridiculousfish
08950b1077 Revert "Bravely set job control to full at startup"
Now that `$last_pid` is never fish's pid, we no longer need to force
jobs to run in their own pgroup. Restore the job control behavior to
what it was prior, so that signals may be delivered properly in
non-interactive mode.

This reverts commit 3255999794
2021-05-25 15:28:53 -07:00
ridiculousfish
33f3c03dae Allow on-job-exit handlers to be added for any pid in the job
Prior to this change, a function with an on-job-exit event handler must be
added with the pgid of the job. But sometimes the pgid of the job is fish
itself (if job control is disabled) and the previous commit made last_pid
an actual pid from the job, instead of its pgroup.

Switch on-job-exit to accept any pid from the job (except fish itself).
This allows it to be used directly with $last_pid, except that it now
works if job control is off. This is implemented by "resolving" the pid to
the internal job id at the point the event handler is added.

Also switch to passing the last pid of the job, rather than its pgroup.
This aligns better with $last_pid.
2021-05-25 15:28:53 -07:00
ridiculousfish
f3d78e21d1 Switch last_pid from the pgroup to the actual last pid
When a job is placed in the background, fish will set the `$last_pid`
variable. Prior to this change, `$last_pid` was set to the process group
leader of the job. However this caussed problems when the job ran in
fish's process group, because then fish itself would be the process group
leader and commands like `wait` would not work.

Switch `$last_pid` to be the actual last pid of the pipeline. This brings
it in line with the `$!` variable from zsh and bash.

This is technically a breaking change, but it is unlikely to cause
problems, because `$last_pid` was already rather broken.

Fixes #5036
Fixes #5832
Fixes #7721
2021-05-25 15:28:53 -07:00
David Dorfman
f2448e3f0e env: remove trailing null-terminator from default path 2021-05-25 08:12:21 +02:00
Fabian Homborg
2b0b0fe042 tests/bind: Skip on Github macOS
This just fails too much to be of any use.
2021-05-23 19:46:04 +02:00
ridiculousfish
35f77a5473 Switch locale_variables and curses_variables from vector to array
No reason to have these be a heap-allocated vector.
2021-05-22 12:50:26 -07:00
Fabian Homborg
fe4eaba563 Fix set_cloexec check
Fixes #8023.
2021-05-22 18:09:15 +02:00
Fabian Homborg
e81b3e06c5 docs: Add a section on subshells to fish-for-bash-users 2021-05-22 17:30:45 +02:00
ridiculousfish
9d696ba7d2 Remove some assignments of wcs2string to references
wcs2string returns a std::string by value; it should not be assigned to a
reference variable.
2021-05-21 13:11:56 -07:00
ridiculousfish
9928404920 Remove some static_asserts out of the common.h header
These asserts require a recursive template instantiation and are currently
checked for every file that pulls in common.h. Place them in a .cpp file so
they are only checked once, hopefully improving compile time.
2021-05-21 13:06:43 -07:00
ridiculousfish
7123e2f25d Remove another errant negation 2021-05-20 11:10:09 -07:00
ridiculousfish
fac8f14e07 Correct a negated pgid
When printing the description of an event, there was an errant negation
from when fish stored the pgid negated. Remove it.
2021-05-20 11:07:36 -07:00
ridiculousfish
504a969a24 Separate on-job-exit and and on-process-exit events
It is possible to run a function when a process exits via `function
--on-process-exit`, or when a job exits via `function --on-job-exits`.
Internally these were distinguished by the pid in the event: if it was
positive, then it was a process exit. If negative, it represents a pgid
and is a job exit. If zero, it fires for both jobs and processes, which is
pretty weird.

Switch to tracking these explicitly. Separate out the --on-process-exit
and --on-job-exit event types into separate types. Stop negating pgids as
well.
2021-05-19 11:29:08 -07:00
Fabian Homborg
406bc6a5d6 docs: Remove obsolete part from functions
This was forgotten in #5951, which allowed `functions --erase` to
prevent functions from being autoloaded.

Fixes #8014
2021-05-19 19:09:46 +02:00
Fabian Homborg
3a0faa4dfd CHANGELOG rewording 2021-05-19 08:41:14 +02:00
Fabian Homborg
d5a30ed103 docs: Split off links to other pages into its own section
This is an attempt to make these more visible - the intro section
explains what this is, and then we mention where to go, and after that
we go into installation and stuff.

I don't think putting "where to go" *after* the installation
instruction is correct, but maybe it is? For the time being, we keep
the order as it is.
2021-05-18 22:53:13 +02:00
Jyry Hjelt
08a455d4f1 Fixed a typo in rc-update autocompletion 2021-05-18 13:55:27 +02:00
Fabian Homborg
0991e0b27f docs: Mention cursor in the wrong position for unicode FAQ
This is now more likely than the staircase thing since
0660ea5be758a25cbfd5703055af122842c10cb0..25595a94c72c8fd1385bfa66b5efecd26839488b.
2021-05-18 13:18:35 +02:00
Fabian Homborg
a09125897e Tests: Set $XDG_DATA_DIRS to empty instead of unsetting
NetBSD's `env` doesn't have `-u` and this should be harmless.
2021-05-18 12:24:24 +02:00
Fabian Homborg
63dd046f99 screen: Remove errant line
This was an experiment that was accidentally committed. Sorry!
2021-05-18 11:27:30 +02:00
Fabian Homborg
5743a536b0 proc: Include sys/wait.h
Might fix build on FreeBSD.
2021-05-18 10:18:50 +02:00
Fabian Homborg
68bd3988d4 builds/FreeBSD: Move to py38-pexpect
Encoding the version like this is annoying and I would wish for
FreeBSD to either stop or provide a "python-pexpect" metapackage that
just pulls in whatever the current version is.
2021-05-18 10:09:13 +02:00
Fabian Homborg
c19a6e912d Readd awkward unused-result dance
This was removed in 962b0f8b90,
presumably with the idea that casting to void, like before, was
enough.

It's not, at least with gcc 11.1
2021-05-18 09:44:29 +02:00
Fabian Homborg
e19ccc8a7a CHANGELOG
Ye olde change logge.
2021-05-18 09:22:40 +02:00
Fabian Homborg
4b2bce7b83 screen: Remove useless .c_str() and wcslen calls
This passed the wchar_t* to outputter::writestr(), which then had to
do a wcslen on it, when it already has a perfectly cromulent
wcstring overload.

Just use that one.
2021-05-18 09:11:56 +02:00
Fabian Homborg
25595a94c7 screen: Also move cursor after printing the prompt
This helps with width issues when no right prompt is used.
2021-05-18 09:09:59 +02:00
Fabian Homborg
0660ea5be7 Move the cursor to the beginning before printing right prompt
This makes the right prompt position independent of the width of the
commandline, which prevents staircase effects. That means, with "X"
standing in as a character that the terminal and fish disagree on:

```
> echo X           rightprompt
```

will stay like that instead of creating a staircase like

```
> echo X            rightpromp
t> echo X             rightpromp
pt> echo X
```

and so on.

The cursor still won't be *correct*, but it will be wrong in a less
annoying way.
2021-05-18 09:09:59 +02:00
ridiculousfish
d3ceba107e Clear to eol before outputting line in multi-line prompt
If the user has a multi-line prompt, we will emit a clr_eol on every
line except the last (see #7404). Prior to this change we would emit
clr_eol after the line, but in some terminals, if the line extended the
width of the tty, the last character would be deleted. Switch to
emitting clr_eol first; now the last character will not be cut off.

Fixes #8002
2021-05-17 21:44:17 -07:00
ridiculousfish
c0b33774ca Update docs on detecting fish_private_mode
fish_private_mode is active if set to something non-empty, but the docs
suggested checking if it is set at all. Switch the docs to match the
implementation through `test -n "$fish_private_mode"`

Fixes #8001
2021-05-17 18:42:52 -07:00
ridiculousfish
6d00ad1045 Ensure that on-process-exit events fire for reaped jobs
This ensures that if a job exits before we have set up the
on-process-exit handler, the handler will still fire.

Fixes #7210
2021-05-17 15:28:32 -07:00
ridiculousfish
60d75e9aa0 Remove proc_create_event
Switch to a set of factory functions inside event_t.
No user-visible change here.
2021-05-17 15:26:59 -07:00
ridiculousfish
962b0f8b90 Pass $status to process-exit event handlers in all cases
Previously, an event handler would receive -1 if the process exited due
to a signal. Instead pass the same value as $status.
2021-05-17 15:25:27 -07:00
ridiculousfish
82fd8fe9fb Refactor wait handles
In preparation for using wait handles in --on-process-exit events, factor
wait handles into their own wait handle store. Also switch them to
per-process instead of per-job, which is a simplification.
2021-05-17 15:25:21 -07:00
Fabian Homborg
b63b511b0a docs: Clarify when on-variable handlers will be run
Fixes #8010.
2021-05-17 17:20:36 +02:00
Fabian Homborg
a427bf207a reader: Fix crash when text is empty after stripping spaces
This crashed on Fedora with the rpm packages, but not when building
from source, so some compiler option triggers it.

But the root cause is us running `text.front()` on an empty string,
which isn't something you should do.

Fixes #8009.
2021-05-16 22:16:22 +02:00
Karolina Gontarek
31f3c16857 Resolve relative paths in command names for complete -p
Fixes #6001
2021-05-16 21:52:38 +02:00