-
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
Clean up WriteConsoleInputA conversion #15672
Clean up WriteConsoleInputA conversion #15672
Conversation
80fcebc
to
42ac9b7
Compare
lead.Event.KeyEvent.uChar.AsciiChar, | ||
trail.Event.KeyEvent.uChar.AsciiChar, |
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.
hey wait a minute, won't this only work for things that take up 2 code units? a UTF-8 string can be up to 4 😉
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.
Yep, it works just as bad as it did before! Well... Sort of. At least it now checks if the trailing event is an actual KEY_EVENT
instead of blindly casting it to a KeyEvent
struct. 😅
I'm hoping to move this entire block of code into InputBuffer
at a later time and come up with a proper caching system.
@DHowett If you get a chance would you mind reviewing this again? |
This commit inlines
EventsToUnicode
intoWriteConsoleInputAImpl
because soon we'll not use deques for events anymore and so the old
code won't work. It cleans up the implementation because I intend to
move all this code directly into
InputBuffer
to have a better andtighter control over how text gets converted. UTF-8 input for instance
requires the storage of up to 3 input events and this code is not fit
to handle that. It's also unmaintainable because our input handling
code shouldn't be spread over a dozen files either. 😄
Validation Steps Performed