SnowyMouse / chimera

The update to Halo PC that never was
https://chimera.opencarnage.net
GNU General Public License v3.0
137 stars 26 forks source link

Fix duplicate chat input #33

Closed surrealwaffle closed 3 years ago

surrealwaffle commented 3 years ago

This PR aims to fix a bug with chat: if two keys are pressed simultaneously, chimera replays the first input instead. The issue is that Halo stores an array of buffered input (up to 64), but chimera was only ever referencing the first element of the array. _static bool ignore_nextkey was a symptom of this, as entering backspace would result in input in the following order:

  1. character = 0xFF, key_code = 0x1D
  2. character = 0x08, key_code = 0xFF

Since the second input replays the first, every time the user hit backspace chimera would see two special backspace characters, thus requiring that every other backspace chimera saw be dropped. Therefore, this PR also makes changes to prevent control characters (as determined by std::iscntrl) from being inserted into chat_input_buffer and removes the ignore_next_key adjustment.

SnowyMouse commented 3 years ago

Gave it a look. Thanks for fixing this!