Commit Graph

14009 Commits

Author SHA1 Message Date
Fabian Homborg
2095d744cf README: Remove "try in browser" leftovers
This was missed in 5a53ead240.
2021-04-22 18:25:28 +02:00
Fabian Homborg
4e41a2bc9f CHANGELOG Remove reverted git change
56af5d0702 reverted the bit that showed
staged state if dirty state wasn't active.
2021-04-22 16:25:00 +02:00
Fabian Homborg
281817f2c5 CHANGELOG prompt stuff 2021-04-22 16:24:38 +02:00
ridiculousfish
42d674819f Make the kill ring thread-safe
Now that the kill ring may be accessed on a background thread, ensure it
is thread safe.
2021-04-21 17:37:44 -07:00
Karolina Gontarek
9d66ddc840 Rename variable to fish_killring 2021-04-21 16:39:29 -07:00
Karolina Gontarek
da97daa800 Add variable to Special variables section 2021-04-21 16:39:29 -07:00
Karolina Gontarek
539837f317 Add variable to documentation 2021-04-21 16:39:29 -07:00
Karolina Gontarek
f1ece78b67 Add CHANGELOG entry 2021-04-21 16:39:29 -07:00
Karolina Gontarek
ed64cf5e34 Implementation of variable with killring entries 2021-04-21 16:39:29 -07:00
ridiculousfish
0a559ac457 Reformat source files with clang-format 2021-04-21 13:31:58 -07:00
Fabian Homborg
f21e015f1b webconfig: Make blue, green, red a bit brighter
These were hard to read in the browser, but not in the terminal.

The palette in color.cpp lists #000080 for blue, which is *even darker*. I'm not sure if that's actually a thing - I was under the impression that table was taken from xterm.

Either way, listing it in this color doesn't do anyone any favors. It's just a rough approximation anyway.
2021-04-21 17:26:52 +02:00
Fabian Homborg
152b0ef018 Webconfig: Sort the prompt list
Otherwise this has filesystem order, which on my system is quite
chaotic.

An alternative would be to randomize the order so people see different
prompts each time.
2021-04-21 17:13:03 +02:00
Fabian Homborg
f2364103b4 Sample prompts: Add a simplified version of my own prompt
Some features:

- A nice `►` prompt char with a fallback for non-utf8 systems
- The $PWD is colored depending on its sha, so different directories
  are colored differently, but each directory stays the same
- User@Host is only shown if not on the local machine (ssh or
  virtualization)
- A right prompt with a nice git display, date, duration of the last
  command (if it took over 100ms), and virtualenv
2021-04-21 17:01:05 +02:00
Fabian Homborg
4355636386 webconfig: Handle right prompt
This gets fish to print the right prompt of any sample if it has any,
and then shows it separately.

If there is a right prompt, it will also save it. If not, it will *not* overwrite an existing right prompt.
2021-04-21 17:01:05 +02:00
Johannes Altmanninger
2fff12104d Correct test environment setup
XDG_RUNTIME_DIR was misspelled.
XDG_DATA_DIRS could affect tests. Remove it since it's used read-only.
2021-04-21 00:47:03 +02:00
ridiculousfish
f4bcfd9085 Correct behavior of string match variable import with multiple arguments
This refactors the behavior of string match with capture groups to
correctly handle multiple arguments. Now the variable capture applies to
the first match, as documented. Fixes #7938.
2021-04-20 15:15:52 -07:00
ridiculousfish
abd59c50b0 Add a test for invalid regex variable names
Also apply some mild refactoring.
2021-04-20 15:15:52 -07:00
ridiculousfish
8e95bba25e Clean up and reduce some allocations in env.cpp 2021-04-20 15:15:52 -07:00
Fabian Homborg
9c413b039d Also fix tokenizer_state in bracketed paste path
Also removes our remaining use of
`__fish_commandline_is_singlequoted`.

See #7782.
2021-04-20 15:29:28 +02:00
Fabian Homborg
dc57ba01a2 __fish_pwd: Just always define the cygwin version
This called `uname` just to check if we *should* shorten "cygdrive"
directories.

That's more annoying than just doing it by default - on my system `pwd
| string replace` takes about 100 *micro*seconds, and this is done
once per prompt. Anyway, using $PWD further speeds it up to ~30
microseconds (compared to 10-20 for just `pwd`). This is hard to
measure because it's heavily impacted by system hitter.

The alternative is to ask cygwin to ship this feature as a patch.
2021-04-19 18:58:00 +02:00
Fabian Homborg
c95a223f5e Better errors when calling a command in a command substitution fails 2021-04-19 16:47:17 +02:00
Fabian Homborg
04f1254c94 Disable tmux tests for now
These are just broken at the moment
2021-04-19 16:46:50 +02:00
ridiculousfish
e8a6d31aea Correct behavior of string match and unmatched capture groups
string match is documented as setting an unset variable if a capture group
is unmatched in an otherwise matched regex, and if the `--all` flag is not
provided. However prior to this fix, it instead set a variable containing
the empty string as a single value. Correct the implementation to match
the documentation.

Note that if the `--all` flag is provided we continue to set empty
strings, which is documented.
2021-04-18 21:04:25 -07:00
ridiculousfish
1aa8200b96 Minor cleanup of builtin_string regex
Mark some classes as final and remove some unnecessary variables.
Add a test in preparation for the next fix.
2021-04-18 20:39:14 -07:00
ridiculousfish
092168485b Remove wcstring_tok
wcstring_tok was a funky function which was confusing and used only in
one place. Replace it with split_string_tok, which is somewhat simpler.
2021-04-18 14:46:05 -07:00
ridiculousfish
2fb0a703de Simplify rgb_color_t::try_parse_named
This came out of an investigation into making strings immutable.
This code did "lazy" lowercasing but we can simplify it by just
providing our own case-insensitive compare routine, which is good
enough for colors.
2021-04-18 12:11:38 -07:00
Fabian Homborg
0111eafbbc tmux tests: Actually use absolute $XDG paths
Erasing $XDG_CONFIG_HOME here means it falls back on the default,
which is ~/.config/, which means it reads user configuration!
2021-04-18 21:09:48 +02:00
Johannes Altmanninger
6b41227ff4 completions/dnf: minor addition to always show RPM files
See #7928
2021-04-18 13:09:36 +02:00
Josh Leichtung
f99127a158 Fix spelling of wheel in Wildcards docs 2021-04-18 07:47:52 +02:00
ridiculousfish
7a556ec6f2 Additional work on tmux-complete test
This removes the relative XDG paths, which could have potentially
confused tmux, and also starts the window with the correct size
instead of adjusting the size afterwards.
2021-04-17 16:43:28 -07:00
ridiculousfish
f7cef13b9b Partially fix the tmux-complete test
The autosuggestion was creeping in, causing us to sometimes show file-1
and sometimes just file-. Allow the race through a regular expression.
2021-04-17 16:43:28 -07:00
ridiculousfish
467755bf4a Bravely optimize job_reap
job_reap is now called more often. This optimizes it by doing an
early-out if there are no running jobs (common at the prompt) and also
skipping the save/restore status, since by inspection we also save and
restore the status when running event handlers.
2021-04-17 16:43:28 -07:00
ridiculousfish
7c153a8307 Introduce prepare_to_select, fixing job_summary.py
This concerns printing status messages for background jobs which have
stopped or finished. Previously fish would do this from two places:

1. Before running a command (including empty string)
2. If a signal is received during select()

So if the job finishes while fish is doing something else (like running an
event handler) then we would not print status messages until the user hit
return. This caused the job_summary.py test to be flaky.

Fix this by splitting the interrupt handler into two parts: a part that
handles signals (e.g. triggering exit from the reader), and a part that
always runs just before blocking in select(). This second part always
reaps jobs and prints their status messages. This narrows the window for a
job exit to be "missed" before fish blocks in select, and should make the
job_summary.py test more reliable.
2021-04-17 16:43:28 -07:00
ridiculousfish
3684c91ad2 Make input_event_queue_t a base class
This concerns the problem of "injecting" fancy fish bits like job reaping
into the "common" input stuff which is also used by fish_key_reader.
Instead of providing a callback, make the input event queue a base class
with virtual functions. This allows for a richer interface and simplifies
some memory management issues.
2021-04-17 16:43:28 -07:00
ridiculousfish
939aba02de Refactor input_common.cpp:readb
readb is used to read a single byte from stdin, or maybe update universal
variables, or maybe invoke completion handlers, etc. Previously it
returned char_event_t but this is more complex than necessary; instead we
can just have it return a single byte, or one of a few special error
codes. This makes the readb's role more clear.
2021-04-17 16:43:28 -07:00
ridiculousfish
78147abe8a Switch the interrupt handler from a global to an instance variable
"The" interrupt handler is used when we get a signal while waiting at the
prompt. Switch it from a global function pointer to an std::function. This
is a mild refactoring which itself will be replaced soon.
2021-04-17 16:43:28 -07:00
ridiculousfish
060ce4f7da Remove timeout input events
Now that timeouts are stored in the event queue peeker, we can remove the
notion of timeout events altogether. Instead you may ask for an event with
a timeout, and get back none on timeout. This simplifies how input events
work.
2021-04-17 16:43:28 -07:00
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