-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Fix reversed the statement when mixed RTL with LTR #169459
Comments
@AhmedElTabarani Is there any code editor which is able to display the text in the desired order (as you post in the second screenshot)? This is the HTML we generate on our side in order to render the first line: <span dir="ltr"><span style="unicode-bidi:isolate">// ما هو JWT ؟</span></span> I've created a fiddle with it at https://jsfiddle.net/Lnsfy1wc/ How should the HTML we generate look like for the first line in order to achieve the desired order and what would be the rules behind generating it in that way? |
I didn't see any code editor support that, any way most of the programs support RTL as GitHub did.
in my website I use two way to achieve that unicode-bidi: "plaintext" or <span dir="auto">...</span> preview: Although |
I think it is better to make an option in |
@AhmedElTabarani Thank you for the two suggestions. I tried both and then did a test pass over various bidi samples I collected over the years. From my testing, I don't think we can ship any of these changes without breaking other samples. To get the rendering that you request, we will need to implement the bidi algorithm in JavaScript. We currently delegate the text rendering in the editor to the browser. I suggest we continue tracking this issue in #11770 . Please see below what I tried: using
|
Sample |
{
"invoice_vip":[
["🖨️ چاپ فاکتور","🎨 تنظیمات"]
]
} |
current rendering | |
with dir="auto" |
using unicode-bidi:plaintext
Running with the change:
diff --git a/src/vs/editor/common/viewLayout/viewLineRenderer.ts b/src/vs/editor/common/viewLayout/viewLineRenderer.ts
index 0e94382f9a8..a9aa11b6872 100644
--- a/src/vs/editor/common/viewLayout/viewLineRenderer.ts
+++ b/src/vs/editor/common/viewLayout/viewLineRenderer.ts
@@ -957,7 +957,7 @@ function _renderLine(input: ResolvedRenderLineInput, sb: StringBuilder): RenderL
sb.appendString('<span ');
if (partContainsRTL) {
- sb.appendString('style="unicode-bidi:isolate" ');
+ sb.appendString('style="unicode-bidi:plaintext" ');
}
sb.appendString('class="');
sb.appendString(partRendersWhitespaceWithWidth ? 'mtkz' : partType);
Sample |
<b>
9- هزینه کاهش ارزش دریافتنیها
</b> |
current rendering | |
unicode-bidi:plaintext |
Does this issue occur when all extensions are disabled?: Yes/No
Statements reversed when mixed RTL with LTR
Steps to Reproduce:
Actually: right order should be as the numbers, should order the words from right to left
Expected: as the order of the numbers
Text:
Note: GitHub displayed the text correctly and also make the whole text go to right of the page
this issue is not "all the text not going to the right of the screen", because that's another issue
this problem is with "sentence imbalance in general"
The text was updated successfully, but these errors were encountered: