Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layout problems with bidirectional text lines #91074

Closed
owenblacker opened this issue Feb 20, 2020 · 4 comments
Closed

Layout problems with bidirectional text lines #91074

owenblacker opened this issue Feb 20, 2020 · 4 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) editor-rendering Editor rendering issues feature-request Request for new features or functionality

Comments

@owenblacker
Copy link

  • VSCode Version: Code 1.42.1 (c47d83b, 2020-02-11T14:45:59.656Z)
  • OS Version: Windows_NT x64 10.0.16299
  • OS locale: en-GB (British English)
  • Does this issue occur when all extensions are disabled?: Yes
  • Does this issue occur in the Insiders build?: Yes

I've just come across a bug in how VS Code handles bidi text on Windows. First off it gets it wrong in one way, but then it changes the display order to get it wrong in a whole different way when I triple-click to select the line.

The logical order of the text is Hebr1 Hebr2 Hebr3 Latn1 Hebr4 Hebr5 Hebr6. which should display RTL, with word Latn1 between Hebr3 (to the right) and Hebr4 (to the left), Hebr1 at the start (right) and Hebr6 at the end (left).

To start with, VS Code shows me the text in chunks, with chunks internally in the correct direction and the chunks in logical order: [Hebr3 Hebr2 Hebr1] [Latn1] [Hebr6 Hebr5 Hebr4]. But triple-click and I get each word internally in the correct direction (so 1rbeH, as it were) but with the words in logical order (so 1rbeH 2rbeH 3rbeH Latn1 4rbeH 5rbeH 6rbeH).

This behaviour occurs both if the bidi text is within a larger HTML file (surrounded by LTR text) or alone in a file (so just bidi text, mainly RTL, in an LTR operating system).

Steps to Reproduce:

  1. Create a file that includes a line reading
    אורך צילום הווידאו עד כ-5 דקות. גודל הקובץ: 1 דקה \ 600MB.
    This is 2 sentences:

    אורך צילום הווידאו עד כ-5 דקות.
    and
    ‏גודל הקובץ: 1 דקה \ ‎600MB.

  2. Triple click to select the whole line and it shows each word in order, with the line displaying LTR, with each word in its correct direction.

As an aside, the text order when selected might be deliberate — it could be considered a solution to issue #83365

These screenshots show the bidi text when unselected, selected and on the page (in that order). There are 2 examples, 1 of text inside <p> ... </p> tags (attached as Bidi text paragraph.html.txt) and 1 of text alone on a line (attached as Bidi text line.txt). In both cases, the screenshot from a browser (the non-monospaced font) is the correct word order for a user to read, and both screenshots from VS Code (monospaced) are incorrect in the ways described above. (The fonts are Open Sans Hebrew and Cousine.)

Bidi text paragraph unselected
Bidi text paragraph selected
Bidi text paragraph on page

Bidi text line unselected
Bidi text line selected
Bidi text line on page

@vscodebot
Copy link

vscodebot bot commented Feb 20, 2020

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@alexdima alexdima added editor-rendering Editor rendering issues feature-request Request for new features or functionality labels Feb 20, 2020
@vscodebot vscodebot bot added this to the Backlog Candidates milestone Feb 20, 2020
@vscodebot
Copy link

vscodebot bot commented Feb 20, 2020

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@jgwl
Copy link

jgwl commented Mar 27, 2020

This can also be reproduced by just highlighting any space character within the sentence. You can get it to jump back and forth by drag-selecting with the mouse, or shift-arrowkey-selecting.
This was working previously to 1.42; I believe it's an introduced bug since then.

@alexdima
Copy link
Member

Duplicate of #90019

@alexdima alexdima marked this as a duplicate of #90019 Mar 30, 2020
@alexdima alexdima added the *duplicate Issue identified as a duplicate of another issue(s) label Mar 30, 2020
@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) editor-rendering Editor rendering issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants