Commit Graph

8573 Commits

Author SHA1 Message Date
Fabian Homborg
4dc1c6ca39 [string] Allow url/var escaping to handle NULs
Fixes #4605.
2018-05-28 12:10:40 +02:00
Fabian Homborg
485fdbde41 [string] Allow length to handle NULs
printf 'a\0b' | string length

used to print "1". Now it prints "3".

Note that this switches to using C++'s std::string::length, which
might give differing results.
2018-05-28 12:10:40 +02:00
Fabian Homborg
bcd23ff971 [string] Allow join to handle NULs 2018-05-28 12:10:40 +02:00
Fabian Homborg
aedb8dc327 [string] Allow string escape to handle NULs
TODO: This currently only works for the "script" escaping style.

Work towards #4605.
2018-05-28 12:10:40 +02:00
Fabian Homborg
a229f703ae Allow escape_string_url from escape_string with wcstring
This was an oversight.
2018-05-28 12:10:39 +02:00
Fabian Homborg
338b40bb43 Trust the passed size in escape_string_script
This allows it to handle NULs.
2018-05-28 12:10:39 +02:00
ridiculousfish
ba69f8f71d Remove an unused variable 2018-05-27 15:46:30 -07:00
ridiculousfish
5492a16719 Clean up some env.cpp export code
Adopt some modern practices.
2018-05-27 15:45:30 -07:00
Swayam Raina
eb0539af60 Don't update CMD_DURATION if no command is requested
Fixes issue #4926
2018-05-27 11:37:36 -07:00
Luca Weiss
c1af560753 pacman: Recognize *.pkg.tar as valid package extension (#5005)
* pacman: Recognize *.pkg.tar as valid package extension
2018-05-26 15:41:46 -07:00
Mahmoud Al-Qudsi
b7db397f61 Fix zfs completions under FreeBSD
Under FreeBSD, as annoying as it is, switches must directly follow the
command or subcommand in question, and cannot come after actual payload
argument. Calling `zpool get all -H` instead of `zpool get -H all`
caused error messages to be spewed to the console under FreeBSD when
simply completing `zfs <TAB>`, this should fix that. The change should
also be compatible with other operating systems (namely Linux) that
don't have this requirement, as they (generally) allow arguments to come
before _or_ after the primary non-switch argument (though I do not have
access to a zfs-enabled Linux machine to test this).
2018-05-26 12:20:04 -05:00
Mahmoud Al-Qudsi
46bd0e66b6 fixup! Clean up completions a little bit
Reverts some changes that broke sudo completions, and adds comments
clarifying the purpose behind sudo completions.

Closes #5004.
2018-05-22 17:44:52 -05:00
Mahmoud Al-Qudsi
6401906288 Fix missing -- in string match in __fish_complete_suffix
Caused completion to fail when current token begins with -
2018-05-22 09:59:16 -05:00
ridiculousfish
1b3154e50e Add fish_feature_flags.cpp to Xcode project
Fixes #4998
2018-05-21 21:53:01 -07:00
Mahmoud Al-Qudsi
7d33372d20 Fix __fish_complete_suffix behavior per __fish_complete_directories test 2018-05-20 14:35:52 -05:00
Mahmoud Al-Qudsi
0a337a9d8e Clean up completions a little bit 2018-05-20 14:07:56 -05:00
Mahmoud Al-Qudsi
fd4b3f2c26 Fix __fish_complete_directories test failure
The `sort -u` was applied only conditionally in __fish_complete_suffix,
now applied universally at the final step.
2018-05-20 13:50:28 -05:00
Mahmoud Al-Qudsi
4be4932786 Fix unzip completions directory completion 2018-05-20 12:33:41 -05:00
Mahmoud Al-Qudsi
beac145e75 Support expansions in directory completions as well
Also fixes some issues with duplicate results in __fish_complete_suffix.
2018-05-20 12:30:07 -05:00
Mahmoud Al-Qudsi
5bd121bd6d Fix unzip completions for non-Linux platforms 2018-05-20 12:04:22 -05:00
Alexander Skwar
9401d3a6d5 Fix fish-shell issue #4996: open -a works now on non-english installs 2018-05-20 21:14:10 +08:00
Alexander Skwar
e6aacd6167 Fix fish-shell issue #4993 - support pathname completion for open -a command. 2018-05-20 21:14:10 +08:00
Mahmoud Al-Qudsi
9ddba0116f Add completions for unzip 2018-05-20 01:22:16 -05:00
Mahmoud Al-Qudsi
ec14507723 Add function to retrieve first token
This should probably be updated to use argparse at some point?
2018-05-20 01:21:03 -05:00
Mahmoud Al-Qudsi
332e17e8e8 Support [*{}~$] in completions with __fish_complete_suffix
Previously, trying to complete a token with any of these
expansion-related characters would cause the completion to return no
results, as it would emit expanded values which weren't matched by the
autocompleter.
2018-05-20 00:38:17 -05:00
Mahmoud Al-Qudsi
4974ecfc32 Block pseudo/meta arguments from ./configure completions
Also finishes faster.
2018-05-17 23:36:56 -05:00
Mahmoud Al-Qudsi
4b78c92652 Optimize structure/layout of __fish_print_packages
Move XDG_CACHE_HOME logic below package providers that don't use the
cache.
2018-05-17 22:21:19 -05:00
Mahmoud Al-Qudsi
1c4940c04c Make sudo completions _much_ smarter
Now dynamically generating completions for the target of the `sudo`
command, where possible.
2018-05-17 20:19:31 -05:00
Fabian Homborg
560985cdee Remove test invocations with implicit -n tests
This is something we would like to remove - #2037.
2018-05-17 13:24:26 +02:00
Fabian Homborg
9de28f6887 Add some more fallback key bindings
DEL (aka backspace) and the arrows.

This makes fish usable without binding functions, though not pleasant.

See #1256.
2018-05-17 11:14:02 +02:00
Mahmoud Al-Qudsi
0dd2607cac Iron out situation with setpgid() calls after posix_spawn()
Closes #4715. Ticks off a box in #4154.
2018-05-16 19:34:56 -05:00
Mahmoud Al-Qudsi
18a163dc24 Simplify argument completions for ttx and meson 2018-05-13 20:00:58 -05:00
Fabian Homborg
ff47b2dad5 [docs] Some rewording to the builtins
Plus some additional examples.
2018-05-14 00:36:49 +02:00
Fabian Homborg
90023e6dfb [docs] Reword abbr
Move the variable discussion to a section at the bottom.
2018-05-14 00:34:56 +02:00
Fabian Homborg
b3ce3e2b7c [docs] Reword variable expansion and cartesian product
This should be a bit nicer to read.
2018-05-13 23:57:16 +02:00
Mahmoud Al-Qudsi
e197e57a7f Clarify ttx completion file table naming case sensitivity 2018-05-13 14:05:57 -05:00
Mahmoud Al-Qudsi
1bdf61cb20 Add completions for meson build system 2018-05-13 13:59:03 -05:00
Mahmoud Al-Qudsi
20395339a4 Fix python{,2,3} argument completions
Only the first non-switch parameter to python must be a .py file, but
everything thereafter is "just another argument". This enables file
completions for 2nd+ arguments.
2018-05-12 23:40:40 -05:00
Mahmoud Al-Qudsi
5f1168002e Complete current commandline token with __fish_complete_directories if
Akin to __fish_complete_suffix, __fish_complete_directories now attempts
to complete the current commandline token if no token is explicitly
passed in as an argument.
2018-05-12 14:06:03 -05:00
Mahmoud Al-Qudsi
82c8abc4dc Add completions for ttx 2018-05-12 14:06:03 -05:00
Fabian Homborg
84fe46e763 [make completions] Reenable files if token contains "="
Fixes #4967.
2018-05-12 18:52:51 +02:00
Mahmoud Al-Qudsi
3cda5ac59b Clean up complete.cpp code
Embrace C++11 ranged for loops.
2018-05-12 11:23:43 -05:00
Fabian Homborg
feb6e9c90b Make DEFAULT_PROMPT and DEFAULT_TITLE work without functions
The prompt is a fallback that is overridden via a function file
anyway.

Do that with the title as well, so we can use just builtins.

This removes error messages when $fish_function_path is borked.
2018-05-12 13:53:45 +02:00
Fabian Homborg
ef66b99721 Remove some dead code
This was a remnant from us checking `string length`. Now that we check
if the variable is set, this code does nothing.
2018-05-12 13:48:32 +02:00
Mahmoud Al-Qudsi
b635863509 Fix warnings when compiling under clang
Introduced by #4849 (add wait for processes by name)

../src/builtin_wait.cpp:23:14: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    while (j = jobs.next()) {
           ~~^~~~~~~~~~~~~
../src/builtin_wait.cpp:23:14: note: place parentheses around the assignment to silence this warning
    while (j = jobs.next()) {
             ^
           (              )
../src/builtin_wait.cpp:23:14: note: use '==' to turn this assignment into an equality comparison
    while (j = jobs.next()) {
             ^
             ==
1 warning generated.
2018-05-11 11:11:53 -05:00
Fabian Homborg
1764716718 Merge branch 'pr/4849'
Yeah, this merge is a bit dirty. Sorry!
2018-05-11 17:01:15 +02:00
Fabian Homborg
c053065e91 Fix wait tests
This was probably the result of a botched merge.

Unfortunately these tests take quite a while, so maybe we should
remove some?
2018-05-11 16:58:55 +02:00
Fabian Homborg
a4f55d95d4 Detect GNU make via "--version"
Turns out that `make -pn` actually takes a while - about 300ms on
fish's makefile.

That's quite a bit of time just to throw away the output and use the
exit code.

So we just check for "GNU" in the version string.

It would be nice to just _do_ the completion and fall back on the
BSD-style if it doesn't work, but that is tricky to do with the pipe
to `awk` - the awk expression actually does not fail if `make` does
not print output.

And I don't know enough about awk to change that.
2018-05-11 16:16:14 +02:00
Fabian Homborg
7c5297e785
Merge branch 'master' into issue_4848 2018-05-11 16:06:27 +02:00
Fabian Homborg
9929acd9d8 Revert "Use git ls-files to generate completions for git"
While this is a bit faster (mostly because it needs less processing on fish's side),
it lacks the neat description bit and the ":/" stuff doesn't work.

The boost is also not large in absolute terms (a few milliseconds).

This reverts commit 1f8e4dad9f.
2018-05-11 16:00:45 +02:00