Repository navigation
Conversation
|
I don't understand the underlying reasoning of this PR. I am primarily concerned that it seems to sometimes return a wcwidth of 2, but I'm not convinced that those scenarios are correct. Can you provide some comments/documentation/reasoning for this change? I believe a more correct fix is for mosh to ship its own up-to-date wcwidth tables, but I'm open to this PR if we can understand its effects more thoroughly. I'd like to see tests added before this can be merged as well. |
I update pr and add some comments. |
|
I think the backstory here is that Mosh relies on the system to advertise (or at least checks and warns if the system doesn't set) It looks like you're talking about a non-STDC_ISO_10646 system where wchar_t represents something else (a UTF-16 code unit). This is outside what Mosh has tried to support in the past (hence the check and warning at build time which I hope you are seeing here?), but of course it's totally reasonable if people want to take this on. I would worry that it does make the parser more complicated to branch on this at runtime -- maybe there should be an entirely different parser for wchar_t=UTF-16 architectures that gets linked in at compile time? But that's just spitballing. |
the parser is almost unchanged, for the improvement just appear on the condition with the failure of the pwccheck. so it should be just some small corner case fix for the parser. a bigger change in this pr i think should be adding a field |
|
@lifei the screenshot you posted honestly leaves me with more concerns. Given what @keithw said above, it seems that this is "WAI" from a mosh perspective that |
In my option, we should just cut the UTF-8 chars into Cells correctly, not converting, then everything would work fine. So the logic should be how to cut the UTF-8 chars to cells and how to know the cell's width. That's all. No unicode, no |
|
You cannot "just cut the UTF-8 chars into Cells correctly" without a lot more information. The bug here, as Keith mentioned above, is an incompatibility between the parser's state machine and the type of |
You're right. What I real mean is that unicode/wchar_t can be used in cutting chars and measuring the length, no used in printing. |
|
That's still not a great idea because the terminal state machine needs to know the width of the characters it's displaying. Just emitting raw bytes means that the state of the outer and inner terminals can desync. |

This pr can make mosh rendering emoji on MSYS2 work fine.