Commit Graph

14772 Commits

Author SHA1 Message Date
Rosen Penev
ba91b39715 replace push_back with emplate_back
The latter forwards the arguments directly.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-08-17 18:56:19 -05:00
Fabian Homborg
c055e3ae66 docs: Reword feature flags chapter 2021-08-17 17:32:41 +02:00
Fabian Homborg
7df833acc1 MOAR CHANGELOG 2021-08-17 16:31:22 +02:00
Fabian Homborg
6c5c8e03c5 Move the numeric locale tests to a different file
This lets us check for locales once, and to have littlecheck mark the
test as skipped.
2021-08-17 15:36:07 +02:00
Fabian Homborg
102853e0e0 Work on the CHANGELOG
Adding some examples seems helpful, there's no need to be super terse.
2021-08-17 13:52:12 +02:00
Fabian Homborg
e9ee1820d6 Default emoji width to 2 for iTerm
Hallelujah, they switched to Unicode 9.

See #8220.
2021-08-17 13:30:34 +02:00
David Adam
a8fddf3d9b add tests for zero-index expressions
See 5326462116 / #8213.
2021-08-17 12:41:03 +08:00
aca
321fd74de0 edit_command_buffer: use "command" to ignore any functions with the same name 2021-08-17 06:24:09 +02:00
David Adam
ef53605fa9 CHANGELOG: work on 3.4.0 2021-08-16 22:01:33 +08:00
David Adam
ff8f26e65a funced: suggest saving functions when an editor is used 2021-08-16 21:45:23 +08:00
David Adam
8dd4c67db1 funcsave: edit the whole file containing a function
Many functions ship in files with helper functions, and it is useful to
edit those too.

Closes #391.
2021-08-16 21:45:22 +08:00
David Adam
52eff27239 funced: don't source or save unmodified files
If funced is just used to inspect a function, there's no need to write
it to storage or to reload it.
2021-08-16 21:44:43 +08:00
David Adam
911269c4a9 funcsave: avoid the edited function's path being a temporary file
As functions know where they are loaded from now, there is no point in
them being marked as loaded from a temporary file that has been removed.
Source the function via a redirect instead.
2021-08-16 21:44:43 +08:00
David Adam
a40e60b45b funced: minor grammar fixes to documentation 2021-08-16 21:44:43 +08:00
Mahmoud Al-Qudsi
0a4f80ec41 Add more tests for literal zero indexes 2021-08-15 13:48:41 -05:00
Mahmoud Al-Qudsi
5326462116 Catch more zero-index expressions
This expands the sanity check for literal zero indexes that was not
updated when range expansions was introduced.

Closes #8213
2021-08-15 13:48:41 -05:00
Fabian Homborg
7f34b8ab53 docs: Add copy buttons to all the codeblocks
This uses a bit of javascript to add copy buttons, so you can directly
copy all the code in a given block to the clipboard!

For codeblocks without prompts, it just copies all the code, for
blocks with prompts, it copies all the lines after prompts, under the
assumption that that's the code to be executed.

It would give you *all* the lines, so the output wouldn't be
interleaved like it is in the html, but good enough.

The buttons appear on hover, so they aren't usable on phones, but
since you won't really have a clipboard on phones and I have no idea
how to make them not always in front of the text otherwise: Eh.

I'm not in love with the javascript here, but it'll do.
2021-08-15 20:09:49 +02:00
Fabian Homborg
e2fef7b392 CHANGELOG 2021-08-14 11:30:30 +02:00
Fabian Homborg
c4593828f4
commandline: Add --is-valid option (#8142)
* commandline: Add --is-valid option to query whether it's syntactically complete

This means querying when the commandline is in a state that it could
be executed. Because our `execute` bind function also inserts a
newline if it isn't.

One case that's not handled right now: `execute` also expands
abbreviations, those can technically make the commandline invalid
again.

Unfortunately we have no real way to *check* without doing the
replacement.

Also since abbreviations are only available in command position when
you _execute_ them the commandline will most likely be valid.

This is enough to make transient prompts work:

```fish
function reset-transient --on-event fish_postexec
    set -g TRANSIENT 0
end

function maybe_execute
    if commandline --is-valid
        set -g TRANSIENT 1
        commandline -f repaint
    else
        set -g TRANSIENT 0
    end
    commandline -f execute
end

bind \r maybe_execute
```

and then in `fish_prompt` react to $TRANSIENT being set to 1.
2021-08-14 11:29:22 +02:00
Fabian Homborg
8767f873eb CHANGELOG set -q change 2021-08-14 10:59:49 +02:00
mtoohey31
703a717660 completion: support --no prefixes for mpv flag options 2021-08-14 10:56:23 +02:00
Fabian Homborg
eee38836cf set -q: Return 255 if no variable name was passed
Previously this strictly returned the number of unset variables. So if
no variable was given, it would return *true*, which is highly
suspect.
2021-08-14 10:55:21 +02:00
Fabian Homborg
35c53a94b5 docs: Remove stuff from globbing
That `find` example is a bit dated and awkward, and doesn't really fit
the section.

We also don't want to point people to `?` because we want to remove it.
2021-08-11 18:42:21 +02:00
Fabian Homborg
013f98a5b3 docs: Double-re-extra mention bash vs fish globbing
And in the section we now point people towards!
2021-08-11 18:41:37 +02:00
Fabian Homborg
b5e5732be1 Point wildcard error at a more specific help section
"Expansion" covers *all* the expansions, that's a bit of a handful.

Directly point people towards globbing.
2021-08-11 18:40:37 +02:00
ridiculousfish
b0b6a585a8 Support Apple_Terminal in fish_vi_cursor
This enables it unconditionally, as tests show that the cursor escapes
are ignored before 10.12.

Fixes #8167
2021-08-10 13:23:08 -07:00
ridiculousfish
fdf8f17397 Stop using thread local vectors
These don't build on macOS 10.9, and are unnecessary anyways.
Thread local variables should only be simple primitives.
2021-08-10 13:07:13 -07:00
Johannes Altmanninger
7b55c0edb4 completions/git: finish completions for git bisect 2021-08-10 21:01:39 +02:00
Johannes Altmanninger
96e665f9ec __fish_complete_subcommand: (re)move confusing comment 2021-08-10 21:01:39 +02:00
Johannes Altmanninger
cb3f3480b2 Fix punctuation in footnote 2021-08-10 21:01:39 +02:00
Johannes Altmanninger
b56b8bb395 Minor changelog tweaks 2021-08-10 21:01:39 +02:00
Johannes Altmanninger
6bd25ff63a Reword comment 2021-08-10 21:01:39 +02:00
Fabian Homborg
da32b6c172 CHANGELOG prompt_pwd 2021-08-09 17:57:27 +02:00
Fabian Homborg
b10d64e22e prompt_pwd: Update docs 2021-08-09 17:42:00 +02:00
Fabian Homborg
6c1ec98e92 prompt_pwd: full-dirs set to 0 means not even last component is safe
Alternative is to print an error.
2021-08-09 17:42:00 +02:00
Fabian Homborg
af2952dd2f Allow passing directories to prompt_pwd
This allows us to test it without cd-ing about the place.
2021-08-09 17:42:00 +02:00
Fabian Homborg
7a8feb4656 prompt_pwd: Allow keeping components full length
And allow passing the parameters as options.
2021-08-09 17:42:00 +02:00
Andrew Schulman
afef67b4e8 Fix dirs returns false when $dirstack is empty 2021-08-09 12:43:03 +02:00
exploide
60a9dcbf05 updated ping completions
support for ping from iputils (version 20210202)
support for ping from inetutils (version 2.1)
support for ping from busybox (version 1.33.1)
support for ping from FreeBSD and macOS (by @juntuu)
2021-08-06 17:08:50 +02:00
Rosen Penev
a00ebc65af remove make_pair
There are better alternatives with C++11.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-08-05 12:12:28 +02:00
Fabian Homborg
5e46ad645a CHANGELOG string width stuff 2021-08-04 21:12:42 +02:00
Fabian Homborg
3ed49304f2 Completions 2021-08-04 21:09:47 +02:00
Fabian Homborg
b2764ad4b1 docs 2021-08-04 21:09:47 +02:00
Fabian Homborg
2087a3ca63 Let visible length work with CR and LF
Because we are, ultimately, interested in how many cells a string
occupies, we *have* to handle carriage return (`\r`) and line
feed (`\n`).

A carriage return sets the current tally to 0, and only the longest
tally is kept. The idea here is that the last position is the same as
the last position of the longest string. So:

abcdef\r123

ends up looking like

123def

which is the same width as abcdef, 6.

A line feed meanwhile means we flush the current tally and start a new
one. Every line is printed separately, even if it's given as one.

That's because, well, counting the width over multiple lines
doesn't *help*.

As a sidenote: This is necessarily imperfect, because, while we may
know the width of the terminal ($COLUMNS), we don't know the current
cursor position. So we can only give the width, and the user can then
figure something out on their own.

But for the common case of figuring out how wide the prompt is, this
should do.
2021-08-04 21:09:47 +02:00
Fabian Homborg
a05fc52fc8 Ignore second escape inside an escape code 2021-08-04 21:09:47 +02:00
Fabian Homborg
ca551fdeb9 string: Add length --visible for visible length
Without escapes.

The new option is a bit cheesy, but "width" isn't as expressive and
requires an argument.

Maybe we want "pad" to also require --visible?
2021-08-04 21:09:47 +02:00
Fabian Homborg
a4756ce561 string: Make pad pad to terminal width
This just changes it so it subtracts escape sequences, according to
the current terminal.
2021-08-04 21:09:47 +02:00
Fabian Homborg
7ad855a844 screen: Make escape_code_length public
Uncached, but we don't want to keep this globally, I think?

This is useful for doing string pad/length without escapes.
2021-08-04 21:09:47 +02:00
Fabian Homborg
fcbf303e05 Only do the macOS apropos thing if makewhatis is available
This won't work without it, and happens to be broken on jailbroken
iOS.

Fixes #8205.
2021-08-04 18:55:01 +02:00
Fabian Homborg
0059192f61 Allow erasing vars via function-scope
This triggered an assert because the remove code had no idea how to
find the function scope.

Oops!
2021-08-04 17:55:41 +02:00