-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bigword movement doesn't handle non-print non-blank characters very well #7328
Comments
With a commandline like ``` a b c d ``` and the cursor at the beginning, this would eat "a b", which isn't a sensible bigword. Bigword should be "a word, with optional leading whitespace". This was caused by an overly zealous state-machine that always ate one char and only *then* started eating leading whitespace. Instead eat *a character*, and if it was whitespace go on eating whitespace, and if it was a printable go straight to only eating printables. Fixes #7325.
Given how important newlines are, I'd call that correct. |
Bigword movement should not stop on newlines. It should stop on words. If I have several blank lines in a row, bigword movement should not step one newline at a time. |
I don't think it's a problem, but if you think it is, feel free to change it. |
On current master, For example, on this commandline,
|
Improves on #7328. I believe this is the correct behavior, simply skip all whitespace before a word. Try with ./fish -C 'bind \ef forward-bigword; bind \eb backward-bigword; bind \ed kill-bigword; bind \cw backward-kill-bigword' Also unrelated formatting fixes. I don't think a CI failure on unformatted code is warranted but I wish it could do that behind the scenes.
Fixed that, it seems better now. |
Bigword movement uses
std::iswblank(c)
andstd::iswgraph(c)
in its implementation, and seems to make the assumption that any character is either blank or graph (or a control character which it doesn't care about). But in the BMP alone there are 6801 codepoints (on my machine running macOS 10.15.6) that are neither blank nor graph or control. Some of these are reserved codepoints, but many are not. For example, Σ (U+03A3 GREEK CAPITAL LETTER SIGMA). Given this, the implementation should probably be using!std::iswblank(c)
anywhere it usesstd::iswgraph(c)
.For that matter, newlines are whitespace but they aren't blank, which means bigword movement stops on every newline, which seems odd. So it should probably be using
std::iswspace
instead ofstd::iswblank
(the former includes 8 characters the latter doesn't).The text was updated successfully, but these errors were encountered: