Don't write position/key codes to memory when sync was not called (#16)

Co-authored-by: Jeremy Sawicki <3847496+jeremysawicki@users.noreply.github.com>
This commit is contained in:
jeremysawicki 2025-03-11 11:59:56 -07:00 committed by GitHub
parent fdea26ae7a
commit fea7c69aff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,10 +86,12 @@ impl Engine {
key_code: u16,
screen_buffer_destination: &mut Vec<u16>,
) -> Option<Vec<u16>> {
self.sync_called = false;
// The clone makes the API easier and doesn't seem to be to expensive in practice.
*screen_buffer_destination = self.screen_buffer.clone();
self.set_input(pos_code, key_code);
if self.sync_called {
self.sync_called = false;
self.set_input(pos_code, key_code);
}
// Even if no expansion is active, triggering the mechanism must still clear the utility buffer.
if self.expansion_triggered {
self.expansion_triggered = false;