Fix console crash and console key input#1880
Fix console crash and console key input#1880VReaperV wants to merge 2 commits intoDaemonEngine:masterfrom
Conversation
d7aff97 to
745136e
Compare
| return Key::NONE; | ||
| } | ||
|
|
||
| std::string KeyToStringUnprefixed( Key key ) { |
There was a problem hiding this comment.
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.
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.
Isn't that handled in SDL_EVENT_KEY_DOWN()?
There was a problem hiding this comment.
That is where the ALT exemption is initially applied. But IIUC this new third level of console key filtering has no condition to check that, so such characters would be filtered out.
| 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.
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)