monkeytype/packages
Nad Alaba 4318601799
fix(funbox): caret/tape/ui issues in backwards funbox (@NadAlaba) (#6956)
### Description

1. refactor:
- store (language direction / state of direction reversing funbox) in
test-state.ts, and set them on `TestLogic.init()` which is called on
each restart which happens on each change of Config.language or funbox.
- use these new direction variables in (caret.ts / test-ui.ts /
pace-caret.ts /result-word-highlight.ts) instead of calling `await
JSONData.getCurrentLanguage(Config.language)`.

2. css changes:
- add `unicode-bidi: bidi-override;` to .words with ligatures in
backwards to fix the direction of LTR words on LTR languages in custom
tests (which now have `.withLigatures` class regardless of language).
- remove `direction: rtl;` from right to left .word and keep it on right
to left #words. This was done because after adding the above
`bidi-override`, (.word)s directioin was being forced to rtl on tests
with RTL language and RTL words (custom and none custom tests), which is
wrong (should be ltr on those tests because of the backwards funbox).
- P.S., removing this from .word does not affect normal tests, because
.word direction is inherited from #words directtion on non
.withLigatures tests (e.g, non custom tests in non withLigatures
languages), and it is calculated using internal browser algorithm based
on characters used in .withLigatures tests (tests in languages with
ligatures and all custom tests).

3. add the property "reverseDirection" to backwards funbox, which
signifies that the direction of the test should be the reverse of the
direction of Config.language, and the direction of a word should be the
reverse of `Strings.isWordRightToLeft()`.

4. allow backwards funbox to work on languages with ligatures.

5. move `void Caret.updatePosition()` call to after the call of
`TestUI.lineJump()` in `input-controller.ts:handleSpace()`.

6. change name of `Strings.getWordDirection()` to
`Strings.isWordRightToLeft()` which explains what does the returned
boolean mean, and add a parameter `reverseDirection` that flips the
final result if true.

---------

Co-authored-by: Miodec <jack@monkeytype.com>
2025-09-19 22:15:03 +02:00
..
contracts impr: add custom error codes to contracts and api doc (@fehmer) (#6976) 2025-09-19 18:59:46 +02:00
eslint-config chore(linting): enable restrict-plus-operands 2025-08-27 11:36:50 +02:00
funbox fix(funbox): caret/tape/ui issues in backwards funbox (@NadAlaba) (#6956) 2025-09-19 22:15:03 +02:00
oxlint-config chore: change oxlint config to jsonc 2025-09-11 22:04:48 +02:00
release chore: change oxlint config to jsonc 2025-09-11 22:04:48 +02:00
schemas feat(layout): add pine v4 layout (@verdant23) (#6958) 2025-09-19 18:18:22 +02:00
tsup-config chore: change oxlint config to jsonc 2025-09-11 22:04:48 +02:00
typescript-config
util chore: change oxlint config to jsonc 2025-09-11 22:04:48 +02:00