Skip to content

Conversation

@VReaperV
Copy link
Contributor

  • Fixes a crash in auto-complete (start typing a command, move cursor back to start of the line, press tab)
  • Fixes console key sometimes being caught in the console input sometimes. This one's a bit difficult to reproduce, I've mainly seen it happen when tabbing out before/during a map change with console open, then tabbing back in after the map loads and opening the console again. Also reproducible by setting input method to UK English in Windows 11, though it has a different underlying cause

return Key::NONE;
}

std::string KeyToStringUnprefixed( Key key ) {
Copy link
Member

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(
Copy link
Member

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)

Copy link
Contributor Author

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])) {
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants