Commit Graph

13972 Commits

Author SHA1 Message Date
ridiculousfish
bd72791340 Use event_queue_peeker_t when matching key bindings
Previously, when attempting to match a key binding, we would dequeue
events from the queue and put them back on if the binding fails. The
tricky part is timeouts: distinguishing between an escaped character and
the escape key itself. This was handled with "timeout events" and we had
to be careful to know when to discard them.

Switch to a new model: use event_queue_peeker more pervasively.
Temporarily dequeued events are stored in the peeker, and the peeker
itself remembers when it has seen a timeout. This is in preparation for
removing the idea of "timeout events" altogether.
2021-04-17 16:43:27 -07:00
ridiculousfish
c570a14c04 Simplify event_queue_peeker_t
Make it an ordinary struct wrapping a vector, instead of a template.
This is in preparation for using it more widely, for matching bindings
as well as mouse CSI sequences.
Also add some mouse-disabling tests.
2021-04-17 16:43:27 -07:00
ridiculousfish
e8a61ef4aa Introduce select_wrapper_t
select_wrapper_t wraps up the annoying bits of using select(): keeping
track of the max fd, passing null for boring parameters, and
constructing the timeout. Introduce a wrapper struct for this and
replace the existing uses of select() with the wrapper.
2021-04-17 16:43:27 -07:00
ridiculousfish
0dd24c8f74 Correct nfds argument to select()
In readch_timed, we were passing 1 as the number of fds. This is correct if
the fd is 0 (stdin) which it typically is; however this will fail if in_ is
not stdin. Switch to in_ + 1.
2021-04-17 16:43:27 -07:00
ridiculousfish
48b42c0255 Reorganize input_event_queue_t declaration
This moves the private bits to the bottom. No functional change.
2021-04-17 16:43:27 -07:00
ridiculousfish
3b32a32dda Replace some format_strings with to_string
This is hopefully a little faster and a little safer as there's
no format string involved.
2021-04-17 16:43:27 -07:00
ridiculousfish
be9579418f Refactor to use has_external_proc instead of a manual loop
No functional change here.
2021-04-17 16:43:27 -07:00
ridiculousfish
e299f89db3 Rename print_job_summary to call_job_summary
No functional change; this is simply a less misleading name.
2021-04-17 16:43:27 -07:00
Johannes Altmanninger
db0fe92aaa completions/dnf: cautiously complete RPM files
Complete RPM files instead of pacakges if there is either
1. a slash in the token, which precludes package names
2. no matching package

To enable 2, pass the commandline token to the dnf query, instead of
an undefined variable. This allows SQL injection; not sure if we care.

We could always complete RPM files but maybe that's too noisy.
Also, isn't that what the "rpm" command is for?

Closes #7928
2021-04-17 22:53:34 +02:00
Johannes Altmanninger
75142f0cde Add Dockerfile for Fedora 2021-04-17 22:53:34 +02:00
Johannes Altmanninger
d96a2e7052 Make docker script work when CDPATH is set
Since #3914 we convert empty CDPATH entries to ".", which makes them
easier to use in fish scripts. This has backfired here, because bash's
cd prints the directory if the "." entry from CDPATH is used.
From bash(1) on cd:

> If a non-empty directory name from CDPATH is used, or  if  -  is
> the  first argument, and the directory change is successful, the
> absolute pathname of the new working directory is written to the
> standard output.

My preferred fix would be to convince bash to amend "non-empty
directory" to "non-empty directory other than .".
2021-04-17 22:53:34 +02:00
Johannes Altmanninger
b3c520cc47 README: link to the Building section 2021-04-17 22:53:34 +02:00
Fabian Homborg
4bcecc8983 docs: Make background at least one screen tall
Otherwise this would look ugly by stopping the gradient after the
content, so in e.g. the `end` or `false` page it would leave an ugly stripe at
the bottom.
2021-04-17 17:36:32 +02:00
Fabian Homborg
d9b212f60b docs: Move some more sections from index to language
These aren't a 100% *exact* fit, but they're mostly language features.
2021-04-16 18:06:33 +02:00
Fabian Homborg
8bc7a85a69 docs: Remove #anchor links
Fixes at least one broken link to syntax
2021-04-16 18:06:33 +02:00
Collin Styles
42c11f1b6c Remove completion files for ls aliases; just use function --wraps 2021-04-16 17:40:55 +02:00
Fabian Homborg
5a53ead240 README: Remove rootnroll
This was removed from fish-site in
7c19bf2cc9a3742346527cd6979671f16b8caeb9 because it's out of date, so
it gives a bad first impression.

In my tests it also loads very slowly and features oh-my-fish instead
of a stock fish.
2021-04-16 15:47:18 +02:00
Fabian Homborg
3b87547411 Fix skipping locale tests on Github Actions 2021-04-16 09:01:41 +02:00
239
5e66722452 Update completions for resolvectl 2021-04-15 17:38:26 +02:00
239
4688a84398 Update completions for loginctl 2021-04-15 17:38:26 +02:00
239
9b85254717 Update completions for Keybase 2021-04-15 17:38:26 +02:00
239
975cd13108 Update completions for cryptsetup 2021-04-15 17:38:26 +02:00
Fabian Homborg
fff158fd2b tests: Disable locale.fish on Github Actions
Sometimes hangs with tsan.

Works around #7934.
2021-04-15 17:26:08 +02:00
Fabian Homborg
9850f8d18a docs: Update status docs
`status --current-function` is not a thing.
2021-04-14 21:46:51 +02:00
Fabian Homborg
84087f09d4 webconfig: Remove gigantic padding 2021-04-14 20:49:24 +02:00
Fabian Homborg
7eddf48cfa webconfig: Cleanup running prompts 2021-04-14 19:08:33 +02:00
Fabian Homborg
333032f626 tests: Increase how long exit_nohang tries
This runs in 100ms increments, so there's not a lot of harm in trying
longer - it should take the same time everywhere it succeeded before.

But I've reproduced failures on FreeBSD 13 on sr.ht, so there's at
least one platform where a total time of 1 second isn't enough.

Now we do 50 tries, which is 5 seconds.
2021-04-14 18:55:11 +02:00
Fabian Homborg
ef96a6614b Update termsize before a sigwinch handler
This could have been one iteration off, e.g.

```fish
function on-winch --on-signal winch
    echo $LINES
end
```

Resize the terminal, it'll print e.g.

24

then run `echo $LINES` interactively, it might have a different answer.

This isn't beautiful, but it works. A better solution might be to make
the termsize vars electric and just always update them on read?
2021-04-14 17:27:53 +02:00
David Adam
9db846a5a7 docs: some improvements to the notes on key bindings
Includes acknowledgement that these are not full editors. Closes #4023.
2021-04-14 21:43:14 +08:00
Fabian Homborg
56af5d0702 Revert "git prompt: Show stagedstate without dirtystate"
After further thinking, showing this now, by default, without a nice way to turn it off isn't great.

This reverts commit 573fed7798.
2021-04-13 19:10:04 +02:00
Xirui Zhao
8bbb06bf5c vi mode: bind u/C-r to undo/redo in place of history search (#7908) 2021-04-13 18:47:34 +02:00
Fabian Homborg
5750351210 Update CHANGELOG 2021-04-13 16:58:22 +02:00
Fabian Homborg
4fa17bd512 git prompt: Don't compute bits we don't need 2021-04-13 16:44:46 +02:00
Fabian Homborg
573fed7798 git prompt: Show stagedstate without dirtystate
I have *no idea* why this was coupled, especially since dirtystate can
be expensive, staged state should not be.
2021-04-13 16:44:46 +02:00
Fabian Homborg
71166274a2 git prompt: Respect status_order even without informative status
Fixes #7926.

Also switches the default status order for non-informative to the informative one:

stagedstate invalidstate dirtystate untrackedfiles stashstate

instead of

dirty staged stash untracked
2021-04-13 16:44:46 +02:00
Fabian Homborg
a65933551d git prompt: Allow setting __fish_git_prompt_status_order
See #7926
2021-04-13 16:44:46 +02:00
Fabian Homborg
db7278bac6 git prompt: Remove that massive documentation block 2021-04-13 16:44:46 +02:00
Jason
80b2eb94f1 alias: print error msgs to stderr 2021-04-13 15:50:00 +02:00
Fabian Homborg
3e473b9f37 io: Silence write error with EPIPE
With something like

```
history | head -n 1
```

this would error "write: Broken pipe", which is just annoying. There
is no *problem* here, `head` closes this on purpose.

Fixes #7924.
2021-04-13 10:38:17 +02:00
David Adam
a918cabf5e feature flags: default stderr-nocaret to on 2021-04-12 22:18:48 +08:00
David Adam
2e44076397 feature flags: add the notion of a default value for each flag 2021-04-12 22:18:48 +08:00
Fabian Homborg
053acf5c6b bind ctrl-space only as a *preset* binding
Fixes #7922
2021-04-11 20:39:54 +02:00
Fabian Homborg
d31d7e4880 docs: Add missing newline 2021-04-11 18:44:19 +02:00
Fabian Homborg
7210261513 complete: Obey --force-files without an option
Things like

```fish
complete command -n '__fish_seen_subcommand_from subcommand'
--force-files
```

would not be obeyed because we only checked force-files when there was
an option.

Fixes #7920.
2021-04-10 21:58:40 +02:00
Fabian Homborg
3100cd1bb7 CHANGELOG 2021-04-10 17:20:27 +02:00
Fabian Homborg
bc4d597e91 Don't abandon line before the first prompt
When a terminal in a tiling WM starts, it might start the shell before
it has reached its "final" size. So we get the terminal width,
then the terminal would be resized (to appease the tiling logic),
and then we would print the abandon line with the omitted newline
char, only if the size got smaller (likely!), we would overflow the
line and land on the next.

So what we do is a bit of a hack: We don't abandon the first line.

This means that `printf %s foo; fish` will overwrite the `foo`, but
that's a super small problem and I don't see another way around this.

Fixes #7893.
2021-04-10 17:13:44 +02:00
Fabian Homborg
16d4424f6c webconfig: Only include path in error if we have one
This makes for a super misleading error message.

See #7917.
2021-04-10 11:53:36 +02:00
Fabian Homborg
e2146a0eee complete: Stop using the function definition as the description
This isn't helpful, and entirely unreadable. Excerpt:

```
__fish_git_prompt_set_char  (set -l user_variable_name "$argv[1]" set -l char $argv[2] if set -q argv[3] and begin set -q __fish_git_prompt_show_informative_status or set -q __fi…)
```

Fixes #7911.
2021-04-08 15:36:59 +02:00
Fabian Homborg
4239ba133d Sample prompts: Add a "simple" prompt
This should be a simple prompt that doesn't place a huge strain on the
system but communicates the most important information simply and
effectively.

It should be a good jumping off point for making your own prompt.
2021-04-08 11:14:16 +02:00
Fabian Homborg
d4ce5507af Sample prompts: Rename classic+vcs to default
That's what it is, and without the "classic" prompt to compare it
doesn't make any sense anymore.
2021-04-08 11:14:16 +02:00