-
Notifications
You must be signed in to change notification settings - Fork 9k
fix: don't print bidi isolates LRI, RLI, FSI, PDI #18942
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
Conversation
lhecker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in the issue, personally I believe this a good approach for solving this. Assuming that we merge it as-is: Thank you for writing and testing the PR in my stead! ❤️
|
As pointed out by @j4james, the previous implementation caused some issues with rendering. The latest commit 5a9b861 moves logic out of the renderer and into the state machine, and adds a test. It also expands coverage to all explicit directional isolates, rather than just FSI and PDI. |
j4james
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the potential performance impact, this seems like a reasonable solution to me. However, if the core team prefers this to be handled in the renderer, I think your original solution could still be made to work, if instead of dropping the isolates, you replaced them with an invisible character with the same spacing semantics (e.g. a zero-width space).
So where you had if (...) continue; you would instead have something like if (...) emplace_back(L'\u200B'); else emplace_back(ch);
This also feels like a hack, but I thought it was worth mentioning as a possible solution if there are objections to your current approach.
|
I apologize for I have only thought about this for roughly eight seconds. If we strip the characters out before the make it into the buffer, they will not be available if the user copies that section of the text. Is keeping the isolates intact for the clipboard important? |
|
Personally, I'd just fix the behavior of zero-width chars in the first column. I effectively prototyped this behavior for Edit's |
Uh oh...
Yes, they direct how the text must be handled. |
So in other words, skip rendering but using the zero-width char approach @j4james suggested, but then also fix the zero-width char rendering bug? Should all that happen in this PR or in separate PRs? |
|
That would be separate PRs and fixing the zero-width thing would be my job because it's a bit difficult. 😅 |
retains them in the state machine so copy/paste works as expected
|
Alright, in that case, I just moved the logic back into the renderer, but this time I'm rendering zero-width spaces instead so as not to actually end up with less characters rendered than went into the renderer. I've tested:
This does remove the test on the state engine; I'm still not sure if there is a place to add a test for this behaviour and if yes where the best place for it to be. Happy to write a test if there's a good spot for one. |
|
@adalinesimonian Sorry for misdirecting you with the whole statemachine tangent. @lhecker When you're looking at the zero-width fix, another issue I noticed is that zero-width characters alter the attributes of the cell that they "occupy", even when they aren't actually consuming any space. So if you have a red zero-width space followed by a green asterisk, the asterisk will actually be rendered in red. echo -e '*\e[31m\U200B\e[32m*\e[m' |
No problem, it's just the name of the game with software. Sometimes one ends up going down a tangent or two. |
j4james
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My approval doesn't really count, but this seems like a reasonable solution to me.
DHowett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is excellent. thank you so much -- and thanks Leonard for the quick/easy patch too
|
Thanks to everyone for the support with this, glad to have helped. Is all that's left to let CI run and then the PR gets auto-merged? Is there a release schedule for how bug fixes go out? Not familiar with this repo just yet, pardon the questions. |
|
UGH. I keep forgetting that I need to manually trigger CI for community pull requests. This should have built and merged last night In general, bug fixes like this will be cherry-picked to the stable and preview branches and released within a couple weeks. We've been focused on other projects lately, so the speed of those releases has dropped a bit. Sorry about that! |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Thanks for the info, I appreciate it! |
Skips rendering LRI, RLI, FSI, and PDI "glyphs" in the terminal. Does not implement BIDI/RTL; that is out of scope, see #538. This is just a hotfix to stop spamming the console with undesired character printouts. Once BIDI support is implemented, this change will (maybe?) no longer be necessary. Fixes #16574. (cherry picked from commit 59590fc) Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgeAsaA Service-Version: 1.23
Summary of the Pull Request
Fixes #16574. Skips printing LRI, RLI, FSI, and PDI characters to the terminal.
References and Relevant Issues
Does not implement BIDI/RTL; that is out of scope, see #538. This is just a hotfix to stop spamming the console with undesired character printouts. Once BIDI support is implemented, this change will (maybe?) no longer be necessary.
Detailed Description of the Pull Request / Additional comments
See discussion starting at @lhecker's comment: #16574 (comment)
Validation Steps Performed
Built, launched console, verified LRI, RLI, FSI, and PDI characters are not printed.
PR Checklist