mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-28 10:59:46 +08:00
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:
parent
36b59ae8ee
commit
b7c06d1ddc
1 changed files with 8 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue