add test & fix for another url detection auto-space issue

This commit is contained in:
Helium314 2023-11-20 00:48:26 +01:00
parent ea17006570
commit 0187beeae5
3 changed files with 14 additions and 3 deletions

View file

@ -32,7 +32,8 @@ fun nonWordCodePointAndNoSpaceBeforeCursor(s: CharSequence, spacingAndPunctuatio
loopOverCodePointsBackwards(s) {
if (!space && Character.isWhitespace(it))
space = true
if (!nonWordCodePoint && !spacingAndPunctuations.isWordCodePoint(it))
// treat double quote like a word codepoint for the purpose of this function (not great, maybe clarify name, or extend list of chars?)
if (!nonWordCodePoint && !spacingAndPunctuations.isWordCodePoint(it) && it != '"'.code)
nonWordCodePoint = true
space && nonWordCodePoint // stop if both are found
}