fix(blind mode): Extra letters in blind mode causing caret problems (@Leonabcd123) (#7254)

### Description

- Enable blind mode
- Write extra letters
- Caret will jump to above the first letter in the word
This commit is contained in:
Leonabcd123 2025-12-16 18:47:38 +02:00 committed by GitHub
parent 36b59ae8ee
commit b7c06d1ddc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -297,13 +297,16 @@ export class Caret {
// we also clamp the letterIndex to be within the range of actual letters
// anything beyond just goes to the edge of the word
let side: "beforeLetter" | "afterLetter" = "beforeLetter";
if (
options.letterIndex >= letters.length ||
(Config.blindMode && options.letterIndex >= wordText.length)
) {
if (options.letterIndex >= letters.length) {
side = "afterLetter";
options.letterIndex = letters.length - 1;
if (Config.blindMode) {
options.letterIndex = wordText?.length - 1;
} else {
options.letterIndex = letters.length - 1;
}
}
if (options.letterIndex < 0) {
options.letterIndex = 0;
}