Commit Graph

8946 Commits

Author SHA1 Message Date
Fabian Homborg
afc82ff23e Math: Truncate integers (scale == 0)
Fixes #5251.
2018-10-24 18:53:33 +02:00
Fabian Homborg
c5d72332ba io: Explicitly reset discard flag
When we discard output because there's been too much, we print a
warning, but subsequent uses of the same buffer still discard.

Now we explicitly reset the flag, so we warn once and everything works
normal after.

Fixes #5267.
2018-10-24 16:59:24 +02:00
Fabian Homborg
809998a9a5 completions/git: Use argparse
This is a tiny bit faster, but mostly it's more concise and extendable.
2018-10-24 12:26:01 +02:00
Fabian Homborg
381215ef07 completions/git: Let git glob files
Fixes #5229.
2018-10-24 12:22:31 +02:00
Fabian Homborg
6bc2e15953 reader: Stringify completion_apply_to_command_line 2018-10-24 11:28:55 +02:00
Fabian Homborg
410e13dd74 expand: Stringify get_home_directory_name
This is actually nicer than the pointilistic version.
2018-10-23 19:10:14 +02:00
Fabian Homborg
884b4c9a61 parse_util: Remove some wcharisms 2018-10-23 19:10:14 +02:00
Fabian Homborg
f64a87a374 path: Make working_directory wcstring
Kinda weird that that one was a wchar_t*
2018-10-23 19:10:14 +02:00
Fabian Homborg
7533fa89d4 complete: Stringify 2018-10-23 19:10:14 +02:00
Fabian Homborg
57cf9055d5 FAQ: Add pkg-config/splitting question
Fixes #4855.
2018-10-23 16:55:44 +02:00
Fabian Homborg
d727e32934 __fish_print_help: Just use $COLUMNS
This had an undocumented internal feature that would pass the tty
width along. Instead, just have it read $COLUMNS, which we always
define anyway.
2018-10-23 15:05:15 +02:00
Fabian Homborg
1d5e715008 source: Return error instead of implicitly reading from tty
For things like

    source $undefined

or
    source (nooutput)

it was quite annoying that it read from tty.

Instead we now require a "-" as the filename to read from the tty.

This does not apply to reading from stdin if it's redirected, so

    something | source

still works.

Fixes #2633.
2018-10-22 21:22:27 +02:00
Fabian Homborg
a04a37897f cmake: Use tinyexpr as yet another ordinary file
Not a library.
2018-10-22 21:15:05 +02:00
ridiculousfish
ac241b7132 Simplify and add tests for ifind 2018-10-21 15:53:58 -07:00
ridiculousfish
fcd4a44b98 Correct check and add a basic test for fuzzy_match_substring_case_insensitive 2018-10-21 12:02:38 -07:00
Fabian Homborg
5efa18da15 fixup! Add /fish to $__fish_config_dir 2018-10-21 17:20:21 +02:00
Fabian Homborg
6c988abe28 Add $__fish_config_dir variable
Contains the path to the user config.fish (e.g. ~/.config/fish)
without having to do the `set -q XDG_CONFIG_HOME` dance.

See #5270.
2018-10-21 15:42:25 +02:00
Fabian Homborg
162af88c9a __fish_parse_configure: Move some comments
This contained a commented-out `eval`, which drew my attention.
2018-10-21 15:38:31 +02:00
Fabian Homborg
3c6844d4f4 edit_command_buffer: Use variable-as-command 2018-10-21 15:34:42 +02:00
Fabian Homborg
3253893923 funced: Use variable-as-command 2018-10-21 15:34:19 +02:00
Fabian Homborg
e9568069a7 help: Use variable-as-command instead of eval 2018-10-21 15:33:29 +02:00
Fabian Homborg
fc51c156cb __fish_config_interactive: Use variable-as-command
This removes a use of eval, and some duplication.
2018-10-21 15:31:49 +02:00
Fabian Homborg
09f77a355f __fish_config_interactive: Remove unused $configdir 2018-10-21 15:31:12 +02:00
Fabian Homborg
3b2be9009e funcsave: Use mkdir -p
It's in POSIX, and simplifies stuff.
2018-10-21 15:24:38 +02:00
ridiculousfish
00b1dd861e Merge branch 'splitenv_1.8'
This merges support for PATH variables. Closes #5245
2018-10-20 12:51:51 -07:00
ridiculousfish
1b5ccb12d5 Document PATH variables 2018-10-20 12:31:44 -07:00
Fabian Homborg
6eccf6557f common: Pass in length for wcs2str with wcstring
Removes _two_ wcslen calls.
2018-10-20 20:52:02 +02:00
Fabian Homborg
d4db4f40a4 Remove another unnecessary wcstring->wchar conversion 2018-10-20 20:52:02 +02:00
Fabian Homborg
27c0ee92de Remove a few useless .c_str()
With .c_str(), these call the wchar_t* overloads, which frequently then go on to call wcslen.
Just directly use the wcstring we already have.
2018-10-20 20:51:05 +02:00
ridiculousfish
f4d666f56c Allow user to set and unset path property of variables
This adds flags --path and --unpath to builtin set, analogous to
--export and --unexport. These flags change whether a variable is
marked as a path variable.

Universal variables cannot yet be path variables.
2018-10-19 17:39:21 -07:00
ridiculousfish
5947aa0171 Join variables by their delimiter in quoted expansion
This switches quoted expansion like "$foo" to use foo's delimiter instead of
space. The delimiter is space for normal variables and colonf or path variables.
Expansions like "$PATH" will now expand using ':'.
2018-10-19 17:35:36 -07:00
ridiculousfish
3f3b3a7006 Export arrays as colon delimited, and support path-style variables
This commit begins to bake in a notion of path-style variables.

Prior to this fix, fish would export arrays as ASCII record separator
delimited, except for a whitelist (PATH, CDPATH, MANPATH). This is
surprising and awkward for other programs to deal with, and there's no way
to get similar behavior for other variables like GOPATH or LD_LIBRARY_PATH.

This commit does the following:

1. Exports all arrays as colon delimited strings, instead of RS.

2. Introduces a notion of "path variable." A path variable will be
"colon-delimited" which means it gets colon-separated in quoted expansion,
and automatically splits on colons. In this commit we only do the exporting
part.

Colons are not escaped in exporting; this is deliberate to support uses
like

    `set -x PYTHONPATH "/foo:/bar"`

which ought to work (and already do, we don't want  to make a compat break
here).
2018-10-19 17:29:39 -07:00
ridiculousfish
ff042bbb7b Relnote %self 2018-10-19 17:13:13 -07:00
ridiculousfish
b66e5ea5ea Merge branch 'percentself'
This merges support for %self

Closes #5249
2018-10-19 17:09:21 -07:00
ridiculousfish
5fa4e0d2ee Highlight %self as an operator 2018-10-19 16:17:30 -07:00
ridiculousfish
d73c487d60 Restore %self to refer to the fish pid
This brings back the %self argument. Like the original %self it only expands
if the argument is literally %self.
2018-10-19 16:17:25 -07:00
Mahmoud Al-Qudsi
6df29b2fd1 Revert "Disable ONLCR mapping of NL output to CR-NL"
This reverts commit 3f820f0edf.
While the premise described by @nbuwe is sound in #4505, we are now
apparently relying on this behavior is some places (although
inadvertently as there doesn't seem to be a deliberate acknowledgement
of that anywhere).

Turning off ONLCR causes things like indented multiline commands to not
appear correct at the tty (subsequent lines appear both at column 0 and
again indented).
2018-10-19 17:49:11 -05:00
Mahmoud Al-Qudsi
3f820f0edf Disable ONLCR mapping of NL output to CR-NL
Per @nbuwe's excellent explanation in #4505, we can save on output
to the tty by maintaining column location after NL by disabling the
ONLCR terminal mode.

Closes #4505.
2018-10-17 21:20:39 -05:00
Mahmoud Al-Qudsi
dfe6bc531e Enable case-insensitive substring fuzzy matching
Adds a new match mode for `string_fuzzy_match_t` that matches against a
case-insensitive subsequence within a string, e.g. `LL` now (partially)
matches against `hello`. This is implemented as a separate mode, given a
lower priority of match than a same-case match (when present).

Note that `fuzzy_match_subsequence_insertions_only` has purposely not
been extended with a case-insensitive version as that would be a)
unlikely to match often, and b) adding a second inefficient fuzzy search
to something that's queried a lot. Perhaps `subsequence_insertions_only`
can simply be changed to be a case-insensitive comparison in the future?

Closes #1196. Affects #3978.
2018-10-16 21:45:04 -05:00
Mahmoud Al-Qudsi
bb829075d8 Add case-insensitive string/wcstring search 2018-10-16 21:42:55 -05:00
Mahmoud Al-Qudsi
259135b211 fixup! Simplify wildcard_complete prototype
Fix broken build under clang 8.0 under Linux.
2018-10-16 20:38:46 -05:00
ridiculousfish
202bf0bede Tab complete abbreviations
This allows abbreviations to be expanded by tab completions.

Fixes #3233
2018-10-16 16:15:27 -07:00
ridiculousfish
161196fe53 Simplify wildcard_complete prototype
Rather than accepting both a 'description' and a 'description function',
accept just the description function.
2018-10-16 15:43:42 -07:00
Mahmoud Al-Qudsi
ec2659c500 fixup! add makensis (#5242) 2018-10-16 13:50:42 -05:00
Mahmoud Al-Qudsi
0e62dedb26 Correct misdetection of [001] as literal zero index
The control flow in expand.cpp is a bit more complicated than it seemed
at first blush. Ref #4862.
2018-10-15 14:11:37 -05:00
Mahmoud Al-Qudsi
c02bf2548f Close the completions pager (if it's open) on ctrl+c
If you're using the old binding that only clears the commandline and
doesn't preserve its contents and start a new line, you can use

```fish
bind \cc "commandline -f cancel; commandline ''"
```

instead.

Closes #4298.
2018-10-15 13:34:34 -05:00
Fabian Homborg
d22446f651 Let funced handle empty $EDITOR
For some weird reason we only used $editor if it wasn't empty, but
then failed to fail if it was.

This will now print an error and use fish, just like if the $EDITOR
value is invalid in any other way.

Fixes #5257.
2018-10-15 10:14:59 +02:00
Mahmoud Al-Qudsi
c140b3c724 Add completions for git config
This includes dynamic completion of existing keys.
2018-10-14 18:17:23 -05:00
Mahmoud Al-Qudsi
a5b8359c1c Add script for diffing two fish profile runs
Came in handy for tracking down the performance regression in #5219. This will
take the output of two (necessarily identical) `fish --profile ...` runs and
produce a third profile log in which all times are the difference between the
first and the second profile provided.

(I'm not sure if build_tools is the right place for it, but I think it's OK?)
2018-10-14 16:45:16 -05:00
Mahmoud Al-Qudsi
a8a9a823f2 Correct unescaped backslash in \n in string.txt 2018-10-14 16:40:27 -05:00