Commit graph

11980 commits

Author SHA1 Message Date
Fabian Homborg
4a9f52466a Set locale during timer test
Fixes #6757
2020-03-15 21:01:11 +01:00
Fabian Homborg
aa629c5aca Reformat fish scripts with escaped newline changes to fish_indent 2020-03-15 21:01:11 +01:00
Fabian Homborg
7891973c9c fish_indent: Add check
This isn't quite the old-style test, but it checks some of the line
continuation stuff.

Note that littlecheck ignores leading whitespace, so testing the
actual indentation requires some more effort.
2020-03-15 21:01:11 +01:00
Fabian Homborg
cb16d9e741 fish_indent: Allow escaped newlines only for certain things
Things like

```fish
\
echo foo
```

or

```fish
echo foo; \
echo bar
```

are a formatting blunder and should be handled.

This makes it so the escaped newline is removed, and the
semicolon/token_type_end handling will then put the statements on
different lines.

One case this doesn't handle brilliantly is an escaped newline after a
pipe:

```fish
echo foo | \
cat
```

is turned into

```fish
echo foo | cat
```

which here works great, but in long pipelines can cause issues.

Pipes at the end of the line cause fish to continue parsing on the
next line, so this can just be written as

```fish
echo foo |
cat
```

for now.
2020-03-15 21:01:00 +01:00
Fabian Homborg
65d277a581 docs: Move left/right arrow to shared bindings
This is a shared binding, so documenting it in emacs was wrong.
2020-03-15 13:24:45 +01:00
Fabian Homborg
463b9b99c6 Move ctrl-left/right forward-word to shared bindings
These also work in vim.

Fixes #6755.
2020-03-15 13:24:45 +01:00
Jason Nader
266ce7c940 Improve Arch Linux package completions
Add completions for `downgrade` tool
Add new `--installed` option for printing Arch packages
Change Arch Linux package related completions to use `--installed`

add newline
2020-03-15 13:19:25 +01:00
Jason Nader
0f681190ba Fix screen optarg completions as they require a space 2020-03-15 10:21:33 +01:00
Johannes Altmanninger
f665cd6367 completions/kak.fish: use old style instead of short options
Kakoune does not accept grouped short options, or option
arguments without a separating space.
2020-03-15 08:50:21 +01:00
ridiculousfish
f117addf7c Use lowercase CMake function names
This is a best practice to distinguish them from variables.
2020-03-14 16:11:35 -07:00
ridiculousfish
f9f5775ccc Switch to C++ random number generator for history vacuum interval 2020-03-14 15:22:46 -07:00
ridiculousfish
87b1c02832 Reformat C++ files 2020-03-14 15:07:54 -07:00
Rosen Penev
fee08a87e9 [cppcheck] add const in several places
Found with constParameter, functionConst, constVariable, constArgument

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-14 15:07:54 -07:00
Rosen Penev
39861d54c5 [cppcheck] add some std::move
Found with passedByValue

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-14 15:07:54 -07:00
Rosen Penev
c3cb44cd22 [cppcheck] don't use rand_r
POSIX 2008 marks it as obsolete.

Found with rand_rCalled

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-14 15:03:14 -07:00
Rosen Penev
fdb2837bc7 [cppcheck] fix wrong format
Found with invalidPrintfArgType_uint

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-14 15:03:14 -07:00
Delapouite
71243ffbdc chore: bump copyright year 2019 → 2020 2020-03-14 14:03:09 -07:00
Tim Sampson
5cf24b7733 completions: add basic completions for 'ip netns' 2020-03-14 15:47:25 +01:00
Johannes Altmanninger
651f3cf863 Fix VSCode not blocking in edit_command_buffer 2020-03-14 14:15:10 +01:00
Johannes Altmanninger
3816c4bb39 Add comment about rounding in timer and appease clang-format 2020-03-14 13:34:31 +01:00
afg
f864bd83ad time builtin: align output columns on rare cases
1. When the wall time and cpu time rows has different units
   e.x. running multiple cores
2. When duration is around 1E3 or 1E6 microseconds
   printf("%6.2F", 999.995) gives 1000.00 which is 7 digits
2020-03-14 13:20:14 +01:00
Delapouite
84c95324e1 doc: add links to count and contains commands in list section 2020-03-14 12:57:51 +01:00
Delapouite
a7f62df958 feat: add missing 'current-selection' completion for commandline
Related to #4255
2020-03-14 12:50:40 +01:00
exploide
a2a12ffda2 removed wrong escaping in completion descriptions 2020-03-14 12:07:58 +01:00
Fabian Homborg
db7dfddc3b completions/systemctl: Remove annoying marker
The output of

systemctl list-units

seems to include a marker of '●' or '*' for some units, even if the
output is not going to a terminal and "--no-legend" and "--no-pager"
are given. This appears
to be a recent development, and there does not appear to be a flag to
disable it.

So we simply filter it out in the completions to once again hopefully
offer the actual units.

Fixes #6740
2020-03-12 18:37:32 +01:00
Fabian Homborg
5ab1e2dc0f help: Always use xdg-open if available
Even if $DISPLAY is unset, xdg-open can be useful, and on systems that
have xdg-open, "open" is most likely some god awful outdated thing
called "openvt" elsewhere.

Fixes #6739

[ci skip]
2020-03-12 17:27:37 +01:00
Fabian Homborg
6237a24573 Fix output with C locale
If given a prompt that includes a non-ascii char and a C locale, fish
currently fails to properly display it.

So you set `function fish_prompt; echo 😃; end` and it shows empty
space.

While the underlying cause is obviously using a C locale and non-C
characters to begin with, this is an unacceptable failure mode.

Apparently I misunderstood wcstombs, so I inadvertently broke this in
2b0b3d3 while trying to fix 5134949's crash.

Just return the offending bit to pre-5134949 levels, so instead of an
infinite recursion we just call a lame function a couple of times.
2020-03-11 20:37:00 +01:00
Johannes Altmanninger
c5e4419097 Add "--" safeguards at string length [ci skip] 2020-03-10 21:01:00 +01:00
Johannes Altmanninger
208b0f9dd5 Interactive config: remove useless argument and correct redirection 2020-03-10 20:56:45 +01:00
Johannes Altmanninger
685b668958 Complete IDs for unix users and groups that start with _ 2020-03-10 20:56:45 +01:00
Delapouite
8320467bb0 doc: add links between the string-split and read commands 2020-03-10 18:25:40 +01:00
Fabian Homborg
0af6d36bb8
Merge pull request #6731 from ammgws/complete-gvim
update gvim completions
2020-03-10 18:24:26 +01:00
Delapouite
4ba98b4d6c fix(cd): remove duplicated comment introducing the cd builtin 2020-03-10 18:24:07 +01:00
Jason Nader
7fb3880b96 completions: remove unnecessary use of --erase 2020-03-10 18:10:49 +01:00
Jason Nader
faa75d74d2
Update gvim completions 2020-03-10 23:52:00 +09:00
ridiculousfish
3040486968 Use -S when invoking Python for littlecheck
This prevents needless imports. It speeds up the test time by ~2 seconds.
2020-03-09 15:08:33 -07:00
Fabian Homborg
9f984ee897 Reindent final check
This included some things in its string, so `fish_indent` would stomp
over it.
2020-03-09 19:46:43 +01:00
Fabian Homborg
9367d4ff71 Reindent functions to remove useless quotes
This does not include checks/function.fish because that currently
includes a "; end" in a message that indent would remove, breaking the test.
2020-03-09 19:46:43 +01:00
Fabian Homborg
6deef37c66 fish_indent: Add more acceptable chars for unquoted words
This adds "_", "-" and "/" as characters for words we strip quotes
from.

The list is admittedly a tad arbitrary.
2020-03-09 19:46:43 +01:00
Fabian Homborg
dc228432d2 fish_indent: Don't unescape backslash-escapes 2020-03-09 19:46:43 +01:00
Fabian Homborg
2f56462e46 unescape_string: Add flag to skip backslash-unescaping
This is sometimes not wanted, like in the case of fish_indent.
2020-03-09 19:46:43 +01:00
Fabian Homborg
b25f72f391 Teach fish_indent to remove useless quotes
This tries to see if quotes guard some expansion from happening. If it
detects a "weird" character it'll leave the quotes in place, even in
some cases where it might not trigger.

So

    for i in 'c' 'color'

turns into

    for i in c color

The rationale here is that these quotes are useless, wasting
space (and line length), but more importantly that they are
superstitions. They don't do anything, but look like they do.

The counter argument is that they can be kept in case of later
changes, or that they make the intent clear - "this is supposed to be
a string we pass".
2020-03-09 19:46:43 +01:00
Fabian Homborg
750e6fa663 completions/openocd: Stop using "which"
"which" is useless.
2020-03-09 19:46:43 +01:00
Delapouite
a9eeca0d14 doc: add interlinks between break and continue commands 2020-03-09 19:24:38 +01:00
rnhmjoj
81668b3f86 completions: fix scp remote path when /bin/ls does not exist 2020-03-09 19:21:43 +01:00
David Adam
57c93f155b debian packaging: make fish-common multi-arch foreign
This means you can install multiple architectures of fish (eg x86 and
x86_64) alongside each other, using the same fish-common package.

Idea from the Debian fish package (version 3.1.0-1.1) by Punit Agrawal
<punit@debian.org>.
2020-03-09 20:02:25 +08:00
ridiculousfish
5886b961d8 Send events more often for variable sets outside of builtin_set
When changing certain variables programmatically, ensure that events
are sent. Fixes #6653
2020-03-08 23:28:37 -07:00
exploide
eac6252ab9 improved find completions 2020-03-08 17:24:14 +01:00
exploide
f39cba1d9f added functions to complete user and group IDs 2020-03-08 17:24:14 +01:00
Johannes Altmanninger
660182cfb3 completions/zfs: finish renaming from 05038fc8 2020-03-08 10:00:57 +01:00