Message Box Rune Support Erroneous
See original GitHub issueDescribe the bug
As of version 1.5.0, the MessageBox
still seems to take issues with runes. Something similar was recently report in issue #1657 (with a PR to solve this in PR #1658). Then again there was also issue #1665 (context menu width) which subsequently got solved in PR #1666. I think a similar bug fix is required for the MessageBox
class.
Here’s a summary of the current state of message box:
language | -usc |
result |
---|---|---|
en_US |
false |
works as expected |
en_US |
true |
invisible message box |
ja_JP |
false |
works but the alignment of the message box message is off |
ja_JP |
true |
invisible message box |
To Reproduce
I noticed this behavior on the application I am currently working on (https://github.com/StefanGreve/dtui/tree/chatview). To reproduce this bug you can run this application with dtui.exe run --langauge [en_US|ja_JP] -usc
. Try to log in (login method is not implemented yet, so any combinations of strings would do the trick) and cancel the process by clicking on the [ cancel ]
button to trigger the message box.
Expected behavior
The message box should be visible (notice that it is still possible to exit the message box form with the now invisible ok
button). Also the Japanese text (and likely any other text which contains runes) should not be cut off. In the GIF below, the text is not really centered when the language profile is set to Japanese.
Screenshots
Desktop (please complete the following information):
- OS: 10
- Version 10.0.19044
Additional context This behavior was observed on CMD, PowerShell and Windows Terminal with always the same outcome. The example in the GIF was run on Windows PowerShell.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top GitHub Comments
Correct, the
-usc
parameter (which enablesApplication.UseSystemConsole
) is meant to be a workaround for Windows Terminal where the TUI wouldn’t look correct if it were not for that. But even without-usc
flag there is still the issue with the text alignment in the message box looking cut off on Windows PowerShell if there are any rune characters (see also: attached screenshot).Just for reference, this is the same table but for Windows terminal:
@tznind is really a bug, but related to several factors, since
TextFormatter
,NetDriver
and more, related with wide runes. I almost have a fix ready.