macOS: Fix doubled key repeats (#570)

This commit is contained in:
Francesca Frangipane 2018-06-17 15:08:26 -04:00 committed by GitHub
parent 38bc6babb7
commit 289fb47a34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View file

@ -396,11 +396,14 @@ extern fn key_down(this: &Object, _sel: Sel, event: id) {
.unwrap()
.push_back(window_event);
}
} else {
// Some keys (and only *some*, with no known reason) don't trigger `insertText`, while others do...
// So, we don't give repeats the opportunity to trigger that, since otherwise our hack will cause some
// keys to generate twice as many characters.
let array: id = msg_send![class("NSArray"), arrayWithObject:event];
let (): _ = msg_send![this, interpretKeyEvents:array];
}
}
let array: id = msg_send![class("NSArray"), arrayWithObject:event];
let (): _ = msg_send![this, interpretKeyEvents:array];
}
}