Closed masarapmabuhay closed 7 years ago
Found the code that causes this issue. It is caused by the String parsing that checks if a substring is a word: https://github.com/usbong/UsbongKit/blob/master/UsbongKit/Views/HintsTextView.swift#L103
// Previous character should be whitespace or newline
let whitespaceAndNewLineCharacterSet = NSCharacterSet.whitespaceAndNewlineCharacterSet()
if range.location > 0 {
let previousCharacterString = string.substringWithRange(NSRange(location: range.location - 1, length: 1))
if previousCharacterString.rangeOfCharacterFromSet(whitespaceAndNewLineCharacterSet) == nil {
foundStringIsWord = false
}
}
To fix this, instead of just checking if the previous character is a whitespace or newline, it should also consider "
.
Let me know if 0addc21 fixes you're issue.
Hi @masarapmabuhay, I updated the code and created PR #19. For a word to be considered a "word" by the parser, the previous character of the word can be any punctuation in general as defined in the Punctuation general category of Unicode character property. Previously, it was set only to whitespace, thus, in "Hindi
was not considered a word previously.
Feel free to merge it to master
once you tested it.
Salut! I noticed that when "open quotation" is used, the word immediately right after it does not show the Word Hint.
Merci beaucoup!