Skip to content

Minecraft: Java Edition 26.3 rewritten from scratch in Rust, checked against vanilla with 281 differential harnesses. Get it with the Horizon launcher.

Chat: Ctrl and Shift read the live modifiers, so Ctrl+Shift+arrows select by word

anweisen1e5c904d1844
diff --git a/crates/horizon-client/src/game/chat.rs b/crates/horizon-client/src/game/chat.rs
index 47d9e396f..a972146bf 100644
--- a/crates/horizon-client/src/game/chat.rs
+++ b/crates/horizon-client/src/game/chat.rs
@@ -770,15 +770,11 @@ impl Game<'_> {
}
/// A key (and the text it typed) while the chat screen is open.
pub(super) fn chat_key_code(&mut self, key: KeyCode, typed_text: Option<&str>) {
- // InputQuirks.EDIT_SHORTCUT_KEY_MODIFIER: Cmd on macOS, Ctrl elsewhere.
- let (left, right) = if cfg!(target_os = "macos") {
- (KeyCode::SuperLeft, KeyCode::SuperRight)
- } else {
- (KeyCode::ControlLeft, KeyCode::ControlRight)
- };
- let ctrl = self.keys.contains(&left) || self.keys.contains(&right);
- let shift =
- self.keys.contains(&KeyCode::ShiftLeft) || self.keys.contains(&KeyCode::ShiftRight);
+ // The live modifiers, not `self.keys`: every ModifiersChanged runs
+ // sync_toggle, which drops ShiftLeft and ControlLeft from `self.keys`
+ // while a screen is open.
+ let ctrl = self.has_control_down_with_quirk();
+ let shift = self.has_shift_down();
match key {
// ChatScreen.keyPressed: the chat scrolls a page.
KeyCode::PageUp | KeyCode::PageDown