-
Notifications
You must be signed in to change notification settings - Fork 73
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
Write characters one by one to display full-width characters correctly #108
base: master
Are you sure you want to change the base?
Conversation
Otherwise, full-width characters overlap on a new Windows console.
da2ce19
to
27960e7
Compare
Thank you; this looks good! |
The only reason is that I was not sure whether this fix is acceptable all the time.
That sounds great. Thank you! |
Thank you for the cleanup. I don't think there is a reason to have the define and the @Bill-Gray: You wanted to check the speed issue and tweak the performance by first checking if the single-display is necessary, correct? |
No. Feel free to modify my code. |
Just returned to this, and I think there's a simpler solution to this problem, requiring two new lines of code and the removal of one old line :
would be modified to read
so that if it's an old console, we'll continue to discard 'dummies', and on new consoles, we'll translate them into spaces. |
### 1.3.1 / 2019-04-21 Bug fixes: * Check whether sizeof(WINDOW) is available to avoid build failures on macOS. Issue #48 reported by chdiza. ### 1.3.0 / 2019-04-16 New features: * Add Curses::Form and Curses::Field. Bug fixes: * Fix TravisCI issues by amatsuda and znz. * Fix typo in sample/menu.rb by binford2k. * Ctrl-/ should return ^_ on Windows. * Workaround for new Windows console. https://github.com/Bill-Gray/PDCurses/pull/108
### 1.3.1 / 2019-04-21 Bug fixes: * Check whether sizeof(WINDOW) is available to avoid build failures on macOS. Issue #48 reported by chdiza. ### 1.3.0 / 2019-04-16 New features: * Add Curses::Form and Curses::Field. Bug fixes: * Fix TravisCI issues by amatsuda and znz. * Fix typo in sample/menu.rb by binford2k. * Ctrl-/ should return ^_ on Windows. * Workaround for new Windows console. https://github.com/Bill-Gray/PDCurses/pull/108
@Bill-Gray It's been a while, but if it is that easy can you include it in 4.2? @shugo I assume that change fixes the issue you see, doesn't it? A note @Bill-Gray: if needed I can recheck for issues with a WinXP and ReactOS VM. |
Apparently, this is not as easy as I thought. I recompiled on my Win10 machine, which has had the unavoidable MS-pushed patches. Now, the fullwidth character really is fullwidth. Combine with the space next to it, and each such character consumes three columns instead of two. To get this to work, it would appear we will need to puzzle out the conditions under which MS rends fullwidth characters in two columns, versus those where it is rendered in one and we really do need that space. We should do that, but I don't think it will be a 4.2 kind of thing. |
Agreed. So no need for @shugo to investigate the "simple but not working solution". |
@Bill-Gray with 4.2 long gone I do wonder where this stands and if you find some time to re-inspect / fix... |
Hmmm... turns out to be easier to handle than I thought; I've implemented a solution in commit fac87bd. The problems arise after displaying a fullwidth character : we may (or may not) then be misaligned by one column. The solution is to say : if we have a packet with a fullwidth character in it (which we'll know because it has a This has the advantage of not requiring us to know whether a given system is in the "fullwidth characters advance the cursor by two columns" or "fullwidth characters advance the cursor by one column" camp. (I think Wine, Win10, and Win11 are in the first camp, and all other systems in the latter camp... but again, with the proposed solution, we don't actually need to figure that out.) An additional benefit : I think this makes handling of combining characters rather simple. I have a solution that works, at least on Wine. I'm having problems testing it on my Win10 box, due to shortcomings in the fonts provided for the Windows console : they lack fullwidth and combining characters. It's not a PDCursesMod issue; Microsoft, in its finite wisdom, just doesn't provide those glyphs. Cut/paste, say, Fullwidth into the console, and you get garbage. So I'll have to install a better font, which is apparently doable, but not at all straightforward. |
Otherwise, full-width characters overlap on a new Windows console.