-
Notifications
You must be signed in to change notification settings - Fork 719
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
[BUG] Sentence end defined incorrectly #5134
Comments
Of course, the example should be:
(facepalm). I mentioned the lack of space requirement after |
A better example (for real):
Placing the cursor on |
I agree this is something to be fixed, I'll try to dedicate a bit of time to that. |
Tools like Unfortunately, in the modern era when typewriters have fallen out of fashion, most typing is done in proportionally-spaced contexts like this text-box, or Microsoft Word, or other tools that handle the whitespace characters for you, so nobody bothers to put two spaces at the end of a sentence anymore. In practice, there is no good way to detect the end of a sentence anymore, and the most reliable approximation is to bake a bunch of special-cases like "Dr." into the code which is inelegant. I don't think Kakoune's "sentence end" selection is a buggy solution to a problem, I think it's a perfectly reasonable solution to a buggy problem. |
FYI, this is how sentence is defined in Vim's help (
This logic is implemented by Vim in function findsent. |
My opening example was completely and stupidly messed up. My latter example is a better one:
Here Kakoune will detect a sentence end at five different places, the first four ones being false positives because they involve a period not followed by a space. It is true that no reasonable definition will eliminate all false positives (e.g., the period in |
Vim's definition also takes into account false negatives to the space-after-period rule such as a sentence Edit: removed "but pending this, requiring punctuation to be followed by at least one space would already be an improvement on the current definition." Thinking twice, the best thing would be either (a) to go all the way to a Vim-like definition, or (b) to leave the current source code as is, given that the sentence-end issue can be improved at the plugin level. |
@ftonneau just an FYI, a colon is a |
You are right, thanks for correcting. I edited my posts accordingly. |
Version of Kakoune
Development version or current version on Arch
Reproducer
Write this in an empty buffer:
My name is A.B. Jones. Be my guest.
Position your cursor at line start (on "M"), then select an outer sentence with
<a-a>s
Outcome
Kakoune selects "My name is A."
Expectations
Kakoune should select "My name is A.B. Jones. "
Additional information
From
selectors.cc
, Kakoune defines the end of a sentence as one of.;!?
characters. This is incorrect in English as well as other Western languages. The end of a sentence is better defined as one of.;!?
characters followed by one or two horizontal spaces or a line return. (A few corner cases could also be considered in English, as when the ending period is followed by a closing quote, but including space after.;!?
would at least take care of the most common cases.)The text was updated successfully, but these errors were encountered: