Commit Graph

12928 Commits

Author SHA1 Message Date
Andrew Prokhorenkov
efe94344e2 builtin_string: extra tests 2020-09-19 19:25:57 -07:00
Andrew Prokhorenkov
2b9158ddab builtin_string: add "--max" for "string pad" 2020-09-19 19:25:57 -07:00
Andrew Prokhorenkov
b11d4c16b8 docs: fix rst formatting for "string pad" 2020-09-19 19:25:57 -07:00
Andrew Prokhorenkov
886290c123 builtin_string: change npad 2020-09-19 19:25:57 -07:00
Andrew Prokhorenkov
f389bb0e97 tests: added tests for "string pad" 2020-09-19 19:25:57 -07:00
Andrew Prokhorenkov
c8e1894c72 builtin_string: add pad command 2020-09-19 19:25:57 -07:00
ridiculousfish
d8e2cac83e Reimplement vectorized reads for detecting ASCII strings
This is a reimplementation of the "vectorized" ASCII detection
from str2wcs_internal. This handles the case where only part of
a string is ASCII. It also avoids pointer overflow issues and improves
commenting.
2020-09-19 17:52:17 -07:00
ridiculousfish
4f0ade7a73 Optimize str2wcs_internal more
Prior to this change, str2wcs_internal had an optimization for ASCII
inputs. However the main cost was the repeated bounds checks when
performing push_back() on the resulting wcstring.

Switch to determining the number of ASCII characters, and then appending
those all in one go. This improves the time in the 'convert_ascii' test
from ~450 usec to ~75 usec.
2020-09-19 17:47:14 -07:00
ridiculousfish
4d5d90d828 Add a simple ASCII conversion test and benchmark
Run `fish_tests perf_convert_ascii` to run the benchmark.
2020-09-19 17:47:12 -07:00
Fabian Homborg
a3e20a4d38 Don't use abbreviated long options
"function --argument" is not a thing, it's "--argument-names". This only
accidentally works because our getopt is awful and allows abbreviated
long options.

Similarly, one argparse test used "--d" instead of "-d" or "--def".
2020-09-19 11:47:41 +02:00
Fabian Homborg
21077c0c9a CHANGELOG A few rewordings
[ci skip]
2020-09-18 22:18:03 +02:00
exploide
ca730cf714 added completions for micro 2020-09-18 19:41:44 +02:00
Fabian Homborg
c4b7abc6ef docs: Misc changes
Some formatting improvements, an explanation of $PWD, and some updates
- --on-process-exit is gone, the fish_command_not_found event is gone,
nobody has sent enhancements via the mailing list in years.

[ci skip]
2020-09-18 17:19:44 +02:00
Fabian Homborg
c53107a3ad docs: Destuffify
There really is no need to show our technical writing prowess here, we
can use plain english.

[ci skip]
2020-09-18 17:10:40 +02:00
Fabian Homborg
d95dc15dac docs: Some more on custom bindings
Show another fish_key_reader run, explain what keys we pressed,
explain the escape delay.
2020-09-18 17:09:44 +02:00
Fabian Homborg
7845539990 docs: Change "Builtin Commands" section
This harkens back to the days of fish's "we don't need no stinkin'
echo" minimalism. That's long past, we have a bunch useful builtins
now just because they are useful, not because they have to be builtins.

[ci skip]
2020-09-18 17:03:56 +02:00
Fabian Homborg
dca6eee55f docs: Less "the user", more "you"
The person reading this is "you". It's completely okay and sounds
better to address them directly.

When we're talking about OS users or users of fish script the reader
writes, "the user" is still okay.

[ci skip]
2020-09-18 16:53:59 +02:00
Fabian Homborg
c188ecf6c7 docs: Reword Tab Completion section
[ci skip]
2020-09-18 16:46:52 +02:00
Fabian Homborg
63adb6871b docs: "fish" is a normal word
We don't need to emphasize it with a monospace block.

Just on index.rst for now.

Work towards #6785.

[ci skip]
2020-09-18 16:40:09 +02:00
Fabian Homborg
c932c03069 docs: Explain more variables for fish_git_prompt
Also some wording enhancements
2020-09-18 16:32:28 +02:00
Johannes Altmanninger
291d1fbf1b Recompute completions if previous attempt failed
When pressing tab repeatedly, completions only computed on the first one. This
is because the old logic assumed that completions are present if the last
key was tab. Recompute them if there are no completions at all.

Fixes #6863
2020-09-17 18:44:54 +02:00
Johannes Altmanninger
6ec0b583f5 __fish_paginate: move the cursor to end of recalled commandline
When pressing \ep on an empty commandline, the cursor would stay at the
beginning of the commandline. Move it to the end of the previous command,
this feels a bit more natural.
2020-09-17 18:44:54 +02:00
Johannes Altmanninger
07c8608034 Fix make -j description 2020-09-17 18:44:54 +02:00
Fabian Homborg
181ce4a6b6 Actually create runtime path if needed
This checked if the path was readable and only then tried creating it,
which... isn't right.

Fixes #7335.
2020-09-17 12:33:56 +02:00
Fabian Homborg
58245b6fe7 set_color: Honor modifiers (bold, background..) with --print-colors
Fixes #7314
2020-09-17 12:33:56 +02:00
Mahmoud Al-Qudsi
304649acc6 [zfs] Add completions for new dataset prefix
[ci skip]
2020-09-16 14:37:59 -05:00
Fabian Homborg
e86a31f6d4 Use the newly fixed test -t in isatty
Removes a weird dependency on the test command.
2020-09-16 21:02:59 +02:00
Fabian Homborg
709e91c1e6 builtin test: Let -t work for the standard streams
Since builtins don't actually have the streams connected, but instead
read input via the io_streams_t objects, this would just always say
what *fish's* fds were.

Instead, pass along some of the stream data to check those
specifically - nobody cares that `test`s fd 0 *technically* is stdin.
What they want to know is that, if they used another program in that
place, it would connect to the TTY.

This is pretty hacky - I abused static variables for this, but
since it's two bools and an int it's probably okay.

See #1228.

Fixes #4766.
2020-09-16 21:02:59 +02:00
Fabian Homborg
1215717d20 Set exit status with delete-or-exit
(regression from d415350aaf)

This is important especially in e.g. the new Windows Terminal, because
for some reason that lets the tab stick around if the process exited
with a non-zero status.

Will add tests as soon as I figure out how.
2020-09-16 21:02:59 +02:00
David Adam
f9505996e7 README/CHANGELOG: make Python requirements consistent
[ci skip]
2020-09-16 15:57:36 +08:00
David Adam
465c2d06aa CHANGELOG: work on 3.2.0
[ci skip]
2020-09-16 15:57:27 +08:00
ridiculousfish
1fd9debaad jobs test to detect zombies before running
If there is any zombie process, the jobs.fish test will fail. Add an
explicit check to report when this happens.
2020-09-13 19:28:14 -07:00
ridiculousfish
2a8e104cc8 Relax some main thread requirements around waiting for jobs
This is now correctly per-parser so the thread should no longer matter.
2020-09-13 17:54:52 -07:00
ridiculousfish
1ba9c7ea56 Use temporary files for the background job pgroup test
This also reduces the likelihood of a race.
2020-09-13 15:36:26 -07:00
ridiculousfish
a698b1f96c Reenable pgroup eval test in more robust form
This re-enables the test that eval retains pgroups, from #6806.
The old version was racey and failed a lot. In the new version, we use
temp files to resolve the race.
2020-09-13 13:44:35 -07:00
ridiculousfish
9ba12aad55 Fix the tests
Make the features_t constructor public so the tests compile. Mea culpa.
2020-09-12 19:06:28 -07:00
ridiculousfish
6e11750479 Make the global feature set an instance variable
Allow it to be inlined.
2020-09-12 17:35:21 -07:00
Fabian Homborg
1c43030d79 cd: Remove unneeded code
This now works in cd proper, so it's unneeded in the function.
2020-09-12 20:17:30 +02:00
Fabian Homborg
5fd3ad624f screen: Show suggestion if the commandline was pushed to a new line
Pretty sure this was just overlooked, the comment mentions that it
should happen and it seems to work.

Fixes #7213.
2020-09-12 20:09:26 +02:00
Fabian Homborg
0072367512 fish_add_path: Don't resolve symlinks
The case for symlinked directories being duplicated a lot isn't there,
but there *is* a usecase for adding the symlink rather than the
target, and that's homebrew.

E.g. homebrew installs ruby into /usr/local/Cellar/ruby/2.7.1_2/bin,
and links to it from /usr/local/opt/ruby/bin. If we add the target, we
would miss updates.

Having path entries that point to the same location isn't a big
problem - it's a path lookup, so it takes a teensy bit longer. The
canonicalization is mainly so paths don't end up duplicated via weird
spelling and so relative paths can be used.
2020-09-12 19:28:01 +02:00
Fabian Homborg
568f9031aa builtin realpath: Add --no-symlinks option
Taken from GNU realpath, this one makes realpath not resolve symlinks.

It still makes paths absolute and handles duplicate and trailing
slashes.

(useful in fish_add_path)
2020-09-12 19:26:04 +02:00
Fabian Homborg
8cf389baf2 tokenizer: Switch to !iswblank instead of iswgraph
Fixes #7328
2020-09-11 23:53:26 +02:00
Fabian Homborg
68ab016267 CHANGELOG/README python 3-ification
Fixes #6537.

[ci skip]
2020-09-11 21:21:04 +02:00
Fabian Homborg
691deac1e4 Print default error in the pacman cnf-handler
Pacman *only* prints the package if it exists, no error or anything.

Fixes #7327.
2020-09-11 20:58:02 +02:00
Fabian Homborg
0e9b496bba Fix bigword bindings with single-character words
With a commandline like

```
a b c d
```

and the cursor at the beginning, this would eat "a b", which isn't a
sensible bigword.

Bigword should be "a word, with optional leading whitespace".

This was caused by an overly zealous state-machine that always ate one
char and only *then* started eating leading whitespace.

Instead eat *a character*, and if it was whitespace go on eating
whitespace, and if it was a printable go straight to only eating
printables.

Fixes #7325.
2020-09-11 20:13:06 +02:00
Fabian Homborg
d688093f7a docs: Update repaint docs
force-repaint now does exactly the same thing as repaint and repaints
are no longer coalesced.
2020-09-11 19:38:55 +02:00
Fabian Homborg
30b2dc2b97 Don't enqueue a repaint in the middle of one
This can easily lead to an infinite loop, if a variable handler
triggers a repaint and the variable is set in the prompt, e.g. some of
the git variables.

A simple way to reproduce:

    function fish_mode_prompt
        commandline -f repaint
    end

Repainting executes the mode prompt, which triggers a repaint, which
triggers the mode prompt, ....

So we just set a flag and check it.

Fixes #7324.
2020-09-11 19:23:26 +02:00
Fabian Homborg
c6cdc06a5b docs: Reword random
Don't SCREAMCAPS random, the command is `random`.

Also some stuffy verbiage.

[ci skip]
2020-09-10 20:48:13 +02:00
Fabian Homborg
624d0b7e42 CHANGELOG complete 2020-09-09 20:24:23 +02:00
Fabian Homborg
7dae2b1e07 docs: Improve complete docs
A bit stuffy, some weird bits (I don't think GNU-style long options
can typically be abbreviated, ``true --v`` and ``bash --hel`` don't work).
2020-09-09 20:23:15 +02:00