-
Notifications
You must be signed in to change notification settings - Fork 69
Fix console crash and console key input #1880
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
base: master
Are you sure you want to change the base?
Conversation
d7aff97 to
745136e
Compare
| return Key::NONE; | ||
| } | ||
|
|
||
| std::string KeyToStringUnprefixed( Key key ) { |
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.
I don't understand, what is the point of forming a string with words like ESCAPE, 0x63 etc.?
| * in a separate execution of IN_ProcessEvents() | ||
| * The key character can also be anywhere in the text | ||
| * This might be an SDL bug */ | ||
| text.erase( |
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.
This would break the feature where you can hold ALT to type a character that would otherwise be a console key (works on some Linux environments)
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.
Isn't that handled in SDL_EVENT_KEY_DOWN()?
| int argNum = args.Argc() - 1; | ||
| std::string prefix; | ||
| if (!args.Argc() || Str::cisspace(GetText()[GetCursorPos() - 1])) { | ||
| if (!args.Argc() || !GetCursorPos() || Str::cisspace(GetText()[GetCursorPos() - 1])) { |
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.
The way things initially go wrong is with the subtraction underflow in std::string commandText = Str::UTF32To8(GetText().substr(1, GetCursorPos() - 1));. Would be nicer to return before that
tab)