monkeytype icon indicating copy to clipboard operation
monkeytype copied to clipboard

impr(tape mode): support RTL languages (@NadAlaba)

Open nadalaba opened this issue 1 year ago • 7 comments

Description

Other than the changes made in #5868, this PR has its changes in its last commit impr(tape mode): support RTL languages (@NadAlaba) which has the following changes:

  1. In scrollTape():

    • Current language is await-checked if it's RTL, which requires scrollTape() to be async.
    • An edit to the calculation of the current word width in tape=letter explained in point 3 below.
    • In RTL, start #words margin-left by putting #words right edge in the center of #wordsWrapper (newMargin = - wordsEl.offsetWidth + wordsWrapperWidth/2), then put the first letter of the first word in that center (newMargin += wordRightMargin), and finally add words widths instead of subtracting them like in LTR.
  2. scrollTape() becomeing async requires? it to be awaited in where it is called which requires the calling functions to become async, and the chain continues. Functions that were changed to async:

    • in test-ui.ts: callback in ConfigEvent.subscribe(), updateActiveElement(), updateWordWrapperClasses(), showWords(), updateWordsMargin(), callback in #words.animate.complete() in scrollTape().
    • in input-controller.ts: backspaceToPrevious(), callback in $("#wordsInput").on("input").
    • in ui.ts: callback in debouncedEvent().
  3. Subtract the width of the last letter that has a positive width if the current letter has a zero width (e.g, diacritics). This is needed when calculation is based on letter widths instead of letter position, which is done in caret.ts when tape=word, and in scrollTape() when tape=letter.

  4. Remove restriction on RTL tape mode from test-logic.ts.

closes #3923

nadalaba avatar Aug 08 '24 19:08 nadalaba

This PR is stale. Please trigger a re-run of the PR check action.

github-actions[bot] avatar Aug 16 '24 20:08 github-actions[bot]

Weird issue i ran into when testing this (sometimes words are slow to appear on the right)

https://github.com/user-attachments/assets/3f0b64fa-8875-49d0-aa77-171266996c08

Miodec avatar Aug 23 '24 12:08 Miodec

Weird issue i ran into when testing this (sometimes words are slow to appear on the right)

Resolved!

Please merge #5824 before this to perform final test on this one.

nadalaba avatar Aug 26 '24 18:08 nadalaba

This PR is stale. Please trigger a re-run of the PR check action.

github-actions[bot] avatar Sep 02 '24 20:09 github-actions[bot]

This is built on top of #5868, so it'd be easier to review that PR first

nadalaba avatar Sep 10 '24 23:09 nadalaba

This PR is stale. Please trigger a re-run of the PR check action.

github-actions[bot] avatar Oct 07 '24 20:10 github-actions[bot]

This PR is stale. Please trigger a re-run of the PR check action.

github-actions[bot] avatar Oct 24 '24 20:10 github-actions[bot]

This PR is stale. Please trigger a re-run of the PR check action.

github-actions[bot] avatar Nov 19 '24 20:11 github-actions[bot]