Skip to content

Commit 7e635f7

Browse files
author
if-can
committed
fix: copy, cut keys not working when the shift key is locked
1 parent 243c1fb commit 7e635f7

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

app/src/main/java/com/osfans/trime/ime/keyboard/CommonKeyboardActionListener.kt

+16-3
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,22 @@ class CommonKeyboardActionListener(
259259
}
260260
}
261261
}
262-
val currentModifier = KeyboardSwitcher.currentKeyboard.modifier
263-
val combinedModifiers = action.modifier or currentModifier
264-
onKey(action.code, if (action.modifier == 0) currentModifier else combinedModifiers)
262+
val modifier =
263+
when {
264+
action.modifier == 0 -> KeyboardSwitcher.currentKeyboard.modifier
265+
(action.modifier and KeyEvent.META_CTRL_ON) != 0 -> {
266+
when (action.code) {
267+
in KeyEvent.KEYCODE_DPAD_UP..KeyEvent.KEYCODE_DPAD_RIGHT,
268+
KeyEvent.KEYCODE_MOVE_HOME,
269+
KeyEvent.KEYCODE_MOVE_END,
270+
-> action.modifier or KeyboardSwitcher.currentKeyboard.modifier
271+
272+
else -> action.modifier
273+
}
274+
}
275+
else -> action.modifier
276+
}
277+
onKey(action.code, modifier)
265278
}
266279
}
267280
}

0 commit comments

Comments
 (0)