-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 line drawing during IME operations. #6223
Conversation
@j4james, this is my proposal. |
…r character during the run and had to potentially skip an attribute and hide the lines.
OK, this is much better than what I had. I ended up having to extend the I'm busy geeking out over the upcoming SpaceX launch at the moment, so I'll try and look at this in more detail later, but my initial impression is very positive. |
I hate that this is possible. 😄 #6224 probably needs separate "line drawing runs" ... |
Agreed. Each thing should probably be its own pass. If it can be efficient enough. |
I've had a chance to run some more tests now, and I'm not sure this is working as well as I had thought. I have a little test case that tries to render every combination of grid flag around a wide character, and that doesn't seem to work with this PR. This is my test code: #include <windows.h>
#include <stdio.h>
void test(WORD attr)
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(handle, 0x07);
printf(" ");
SetConsoleTextAttribute(handle, 0x07 | attr);
printf("\xE5\xA4\xA7");
SetConsoleTextAttribute(handle, 0x07);
}
void main()
{
SetConsoleOutputCP(CP_UTF8);
printf("\n");
test(COMMON_LVB_GRID_LVERTICAL);
test(COMMON_LVB_GRID_HORIZONTAL);
test(COMMON_LVB_GRID_RVERTICAL);
test(COMMON_LVB_UNDERSCORE);
test(COMMON_LVB_UNDERSCORE | COMMON_LVB_GRID_LVERTICAL);
test(COMMON_LVB_GRID_LVERTICAL | COMMON_LVB_GRID_HORIZONTAL);
test(COMMON_LVB_GRID_HORIZONTAL | COMMON_LVB_GRID_RVERTICAL);
test(COMMON_LVB_GRID_RVERTICAL | COMMON_LVB_UNDERSCORE);
test(COMMON_LVB_UNDERSCORE | COMMON_LVB_GRID_HORIZONTAL);
test(COMMON_LVB_GRID_LVERTICAL | COMMON_LVB_GRID_RVERTICAL);
test(COMMON_LVB_GRID_LVERTICAL | COMMON_LVB_GRID_RVERTICAL | COMMON_LVB_UNDERSCORE);
test(COMMON_LVB_GRID_LVERTICAL | COMMON_LVB_GRID_RVERTICAL | COMMON_LVB_GRID_HORIZONTAL);
test(COMMON_LVB_GRID_LVERTICAL | COMMON_LVB_GRID_RVERTICAL | COMMON_LVB_GRID_HORIZONTAL | COMMON_LVB_UNDERSCORE);
printf("\n");
} This is what I expected it to look like (more or less - not sure about the center grid lines, but I think that's a separate issue): This is what I'm seeing with this PR: I'm hoping maybe I've just screwed up the build somehow. Will do some more digging. |
One other thing I wanted to mention. It's not essential for this PR, but I thought while you're looking at this grid code, it might be a good time to get rid of |
大 is
|
Conhost v1 with the scratch code: Repaired OpenConsole on commit e1c757f: |
I went and read the code for this from conhostv1.
So yeah, I think it can go away and/or be repurposed. |
I believe this is good for merge. It restores the behavior to match v1 conhost in both through-the-API and IME cases. |
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.
Okay, this looks sane, and there's enough comments that I could figure out what was going on here. Good enough for me 😄
Hello @DHowett! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
For the record this looked good to me too. Your solution turned out much simpler than what I thought would be required. 👍 |
🎉 Handy links: |
Summary of the Pull Request
Restores proper line drawing during IME operations in
conhost
PR Checklist
Detailed Description of the Pull Request / Additional comments
ConsoleImeInfo::s_ConvertToCells
to be less confusing. It's doing about the same thing, but it's way easier to read now and the compiler/linker/optimizer should just be the same.Renderer::_PaintBufferOutputHelper
to check each attribute for line drawing characters as the right half of a two-col character might have different line drawing characters than the left-half.Validation Steps Performed
SetConsoleTextAttribute
per @j4james's sample code