Commit Graph

13256 Commits

Author SHA1 Message Date
Fabian Homborg
f6da895df4 CHANGELOG: Webconfig theme 2020-12-04 17:08:45 +01:00
Fabian Homborg
96dd8d511e Webconfig: Let it work better on small screens
This allows it to basically work down to quite small widths.
2020-12-04 17:08:45 +01:00
Fabian Homborg
8c5f733e20 Webconfig: Fix error message
For some reason this didn't like the min-height inside the ng-style
thing.
2020-12-04 17:08:45 +01:00
Fabian Homborg
6418e8ea68 Webconfig: Let theme match help and fishshell.com
More consistency is nice.
2020-12-04 17:08:45 +01:00
Fabian Homborg
aaf5bfc25f Webconfig: Support reading term24bit colors for the prompt display
Otherwise this would break colors if fish detected a truecolor terminal.
2020-12-04 17:08:45 +01:00
Fabian Homborg
44eadd8bed CHANGELOG: Add some of the recent work 2020-12-04 17:02:59 +01:00
Fabian Homborg
672fdde1f0 __fish_print_packages: Better parse apt-cache's weird format
Fixes #7521.
2020-12-04 16:45:14 +01:00
Fabian Homborg
b9b84e63bf Revert "Attempt to simplify how completions get presented in the pager"
The pager cleanup missed that the existing token could already include active (as in unescaped) expansions, and just escaped them all.

This means things like `ls ~/<TAB>` would escape the `~`, which is obviously wrong and makes it awkward to use.

This reverts commit b38a23a46d.

I fully expect that we'll try again, but there's no use in keeping master broken while that happens.

Fixes #7526.
2020-12-04 16:44:48 +01:00
Fabian Homborg
720982a3cb string: Quit early if --quiet is satisfied
E.g. if we do `string match -q`, and we find a match, nothing about
the input can change anything, so we quit early.

This is mainly useful for performance, but it also allows `string`
with `-q` to be used with infinite input (e.g. `yes`).

Alternative to #7495.
2020-12-01 18:55:01 +01:00
Abu Sakib
8f165ab26b CONTRIBUTING: Fix links for littlecheck and pexpect 2020-12-01 15:22:48 +01:00
Fabian Homborg
eb592092a6 fixup! Only disable WINCH handling in VTE
Apparently iTerm doesn't reflow?

See #7491
2020-11-30 20:50:02 +01:00
Fabian Homborg
df137695bb Disable WINCH handler in reflowing terminals
Fixes #7491.
2020-11-30 20:01:33 +01:00
Fabian Homborg
2fef089c91 CONTRIBUTING: Enhance the "testing" section
Link to littlecheck, explain where pexpect is being setup,

[ci skip]
2020-11-30 18:28:24 +01:00
Fabian Homborg
9567df4b15 Update littlecheck to 06457b194883879fe08282f84863fa37080c27a5
This fixes a bug where it would fail to match some regexes.
2020-11-30 18:16:42 +01:00
Mahmoud Al-Qudsi
8aac537191 Silence GCC warn_unused_result warnings in tests
warn_unused_result is the persistent one that won't go away with a
simple `(void)write(...)` and needs to be assigned to a variable (that
must then also be declared unused or else you'll get a warning about
_that_).
2020-11-29 18:12:09 -06:00
ridiculousfish
74b298a6f9 Fix a gcc warning about comparison of different signedness 2020-11-29 14:06:04 -08:00
ridiculousfish
f5f0f98991 Remove expand_flag::skip_jobs
It was unused.
2020-11-29 14:01:13 -08:00
ridiculousfish
2b8d2deb0c Introduces "smartcase" completions
"smartcase" performs case-insensitive matching if the input string is all
lowercase, and case-sensitive matching otherwise. When completing e.g.
files, we will now show both case sensitive and insensitive completions if
the input string does not contain uppercase characters.

This is a delicate fix in an interactive component with low test coverage.
It's likely something will regress here.

Fixes #3978
2020-11-29 12:40:01 -08:00
ridiculousfish
b38a23a46d Attempt to simplify how completions get presented in the pager
This is an attempt to simplfy some completion logic. It mainly refactors
reader_data_t::handle_completions such that all completions have the token
prepended; this attempts to simplify the logic since now all completions
replace the token. It also changes how the pager prefix works. Previously
the pager prefix was an extra string that was prepended to all
completions. In the new model the completions already have the prefix
prepended and the prefix is used only for certain width calculations.

This is a somewhat frightening change in an interactive component with
low test coverage. It tweaks things like how long completions are
ellipsized. Buckle in!
2020-11-29 12:35:18 -08:00
ridiculousfish
4b947e0a23 Refactor string fuzzy matching
In preparation for introducing "smart case", refactor string fuzzy
matching. Specifically split out the case folding and match type into
separate fields, so that we can introduce more case folding types without
a combinatoric explosion.
2020-11-29 12:35:18 -08:00
ridiculousfish
20b98294ba Bravely remove string_fuzzy_match_t::compare
This is used to decide which fuzzy match is better, however it is used
only in wildcard expansion and not in actual completion ranking or
anywhere else where it could matter. Try removing the compare() call
and implementation.

What compare() did specially was compare distances, e.g. it ranks
lib as better than libexec when expanding /u/l/b. But the tests did not
exercise this so it's hard to know if it's working. In preparation for a
refactoring, remove it.
2020-11-29 12:35:18 -08:00
ridiculousfish
ac1ee6f1fd Make fuzzy_match_type_t an enum class
Also rename it to fuzzy_type_t and shorten some of its values.
2020-11-29 12:35:18 -08:00
ridiculousfish
9144141ded Migrate string_fuzzy_match from common.h to wcstringutil.h
This is a more appropriate location for this functionality.
Also take this opportunity to clean up subsequence_in_string.
2020-11-29 12:35:18 -08:00
ridiculousfish
639cd66ba1 Conditionally make autosuggestions case sensitive
When fish presents an autosuggestion, there is some logic around whether
to retain it or discard it as the user types "into" it. Prior to this
change, we would retain the autosuggestion if the user's input text is a
case-insensitive prefix of the autosuggestion. This is reasonable for
certain case-insensitive autosuggestions like files, but it is confusing
especially for history items, e.g. `git branch -d ...` and `git branch -D
...` should not be considered a match.

With this change, when we compute the autosuggestion we record whether it
is "icase", and that controls whether the autosuggestion permits a
case-insensitive extension.

This addresses part of #3978.
2020-11-29 12:35:18 -08:00
ridiculousfish
1094b95b6f Mild refactoring of autosuggestions
Rather than storing an autosuggestion as a string, store a struct.
This is preparing to conditionalize autosuggestion case sensitivity.
2020-11-29 12:35:18 -08:00
ridiculousfish
d9ebe13cb4 Reorganize and improve commenting of autosuggest_validate_from_history
No behavior change expected here.
2020-11-29 12:35:18 -08:00
Enrico Maria De Angelis
2a86099cfd
fish_vi_key_bindings: Implement "d;" and "d," (#7516) 2020-11-29 21:24:42 +01:00
David Adam
f396a43280 debian packaging: drop recommendation for distutils
No longer required since 9de809ee98
2020-11-29 20:05:41 +08:00
Johannes Altmanninger
7da93e2617 builtin functions: don't mix up multiple arguments
This regressed in 2e38cf2a which is contained in 2.6.0.

Fixes #7515
2020-11-29 06:35:02 +01:00
Johannes Altmanninger
4ed22246c3 completions/gem: do not execute completion description 2020-11-29 06:07:00 +01:00
Johannes Altmanninger
79df29e8fd Remove some dead functions in the highlighter
These are replaced by "visit" methods.
2020-11-29 05:59:16 +01:00
Johannes Altmanninger
7c7eac1182 fixup! docs: use monospace for inline code snippets more consistently 2020-11-29 05:59:16 +01:00
Fabian Homborg
9de809ee98 webconfig: Remove LooseVersion
This writes super cheesy version checking, but allows us to remove
distutils.

Fixes #7514.

Hat tip @zanchey for the check.
2020-11-28 16:12:21 +01:00
Fabian Homborg
eb517e0bdd webconfig: Determine if we're termux without distutils
Just copy that "find an executable" code we already have,
the one that was commented with "oh, btw, distutils.spawn.find_executable is bad",
and use it here as well.

Work towards #7514.
2020-11-28 16:11:09 +01:00
Mahmoud Al-Qudsi
aa0bfa0eb8 Minor cleanup
clangd needs to respect clang-format files when inserting headers up
top.

[ci skip]
2020-11-28 01:00:27 -06:00
Mahmoud Al-Qudsi
a3cb1e2dcd Fix setting terminal title after fg
The code to override the `(status current-command) was present`, but not
handled in either the default `fish_title` function or the fallback.

Closes #7444.
2020-11-28 00:56:10 -06:00
Fabian Homborg
9bcfa851c1 CHANGELOG math --base
[ci skip]
2020-11-27 19:50:04 +01:00
Fabian Homborg
7e9b1f871b CHANGELOG: Use :issue: role
[ci skip]
2020-11-27 19:48:58 +01:00
Fabian Homborg
27039ed46f docs: Double-up "`"
Otherwise sphinx complains "WARNING: Inline emphasis start-string without end-string"

[ci skip]
2020-11-27 19:46:18 +01:00
Fabian Homborg
5872f4522d math: Add --base option
Currently a bit limited, unfortunately printf's `%a` specifier is
absolutely unreadable.

So we add `hex` and `octal` with `0x` and `0` prefixes respectively,
and also take a number but currently only allow 16 and 8.

The output is truncated to integer, so scale values other than 0 are
invalid and 0 is implied.

The docs mention this may change.
2020-11-27 19:33:27 +01:00
ridiculousfish
30c7a17302 Set tty to shell mode before running fish_prompt
Prior to this change, we would run fish_prompt and then afterwards set
the shell modes. For users with an initially slow prompt, this would
mean that characters would be echoed to the tty until after the prompt
completes.

Reorder these so that we set the tty mode first. This implies we will
run the prompt in shell mode, but this was already the case up until
2a3677b386.

Fixes #7489. Note that the prior commit e0cedd4ad2 is also necessary
here, as that fixed an extra prompt execution.
2020-11-26 16:47:08 -08:00
ridiculousfish
e0cedd4ad2 Remove exec_prompt call from read_push
This prompt execution does not appear to be necessary, and spoils the
upcoming fix for #7489
2020-11-26 16:38:33 -08:00
ridiculousfish
a434ec0e19 Remove '--import' from regex string match tests
The '--import' flag was used for importing named capture groups, but it
was decided to always import them unconditionally. This flag was causing
the tests to fail.
2020-11-26 16:27:57 -08:00
Mahmoud Al-Qudsi
962ff26b92 Add named capture groups to changelog 2020-11-26 14:41:31 -06:00
Mahmoud Al-Qudsi
f172b215cf Add documentation for regex import 2020-11-26 14:41:31 -06:00
Mahmoud Al-Qudsi
edb7897b4d Add tests for regex variable import 2020-11-26 14:41:31 -06:00
Mahmoud Al-Qudsi
5ddafb3b79 Add support for importing named regex matches
The new commandline switch `string match --regex --import` will import
as fish variables any named capture groups with the matched captures as
the value(s).
2020-11-26 14:41:00 -06:00
Mahmoud Al-Qudsi
282fb14dcf Get rid of magic numbers in report_match() result
Replace with a class-local `enum class` instance.
2020-11-26 14:38:04 -06:00
Fabian Homborg
a14e64ed6c math: Don't override errors with "unexpected token"
As always, we want to give the most specific error we can.

Fixes #7508
2020-11-26 12:41:19 +01:00
Fabian Homborg
903a9fbf0c math: Don't match longer function names
The comparison here is a bit naive, so "n" matches "ncr", so
technically

   math 'n(2, 3)'

is equivalent to

   math 'ncr(2, 3)'

Work towards #7508.
2020-11-26 12:37:09 +01:00