0
0
mirror of https://github.com/florisboard/florisboard.git synced 2024-09-20 03:52:18 +02:00

Fix shift+space swipe not selecting text (#1843)

This commit is contained in:
Patrick Goldinger 2022-05-27 19:16:04 +02:00
parent cda111f623
commit 5d88058354

View File

@ -699,6 +699,11 @@ private class TextKeyboardLayoutController(
pointer.pressedKeyInfo?.cancelJobs()
pointer.pressedKeyInfo = null
if (pointer.hasTriggeredMassSelection) {
pointer.hasTriggeredMassSelection = false
editorInstance.massSelection.end()
}
val initialKey = pointer.initialKey
val activeKey = pointer.activeKey
if (initialKey != null && activeKey != null) {
@ -743,6 +748,11 @@ private class TextKeyboardLayoutController(
pointer.pressedKeyInfo?.cancelJobs()
pointer.pressedKeyInfo = null
if (pointer.hasTriggeredMassSelection) {
pointer.hasTriggeredMassSelection = false
editorInstance.massSelection.end()
}
val activeKey = pointer.activeKey
if (activeKey != null) {
activeKey.isPressed = false
@ -857,13 +867,11 @@ private class TextKeyboardLayoutController(
val count = if (!pointer.hasTriggeredGestureMove) it - 1 else it
if (count > 0) {
inputFeedbackController?.gestureMovingSwipe(TextKeyData.SPACE)
if (editorInstance.activeInfo.isRawInputEditor) {
keyboardManager.handleArrow(KeyCode.ARROW_LEFT, count)
} else {
// TODO: Maybe find way to integrate this into mass select?
val selection = editorInstance.activeContent.selection
editorInstance.setSelection(selection.end - count, selection.end - count)
if (!pointer.hasTriggeredMassSelection) {
pointer.hasTriggeredMassSelection = true
editorInstance.massSelection.begin()
}
keyboardManager.handleArrow(KeyCode.ARROW_LEFT, count)
}
}
true
@ -878,13 +886,11 @@ private class TextKeyboardLayoutController(
val count = if (!pointer.hasTriggeredGestureMove) it - 1 else it
if (count > 0) {
inputFeedbackController?.gestureMovingSwipe(TextKeyData.SPACE)
if (editorInstance.activeInfo.isRawInputEditor) {
// TODO: Maybe find way to integrate this into mass select?
keyboardManager.handleArrow(KeyCode.ARROW_RIGHT, count)
} else {
val selection = editorInstance.activeContent.selection
editorInstance.setSelection(selection.end + count, selection.end + count)
if (!pointer.hasTriggeredMassSelection) {
pointer.hasTriggeredMassSelection = true
editorInstance.massSelection.begin()
}
keyboardManager.handleArrow(KeyCode.ARROW_RIGHT, count)
}
}
true
@ -1008,6 +1014,7 @@ private class TextKeyboardLayoutController(
var activeKey: TextKey? = null
var hasTriggeredGestureMove: Boolean = false
var hasTriggeredLongPress: Boolean = false
var hasTriggeredMassSelection: Boolean = false
var pressedKeyInfo: InputEventDispatcher.PressedKeyInfo? = null
override fun reset() {
@ -1016,6 +1023,7 @@ private class TextKeyboardLayoutController(
activeKey = null
hasTriggeredGestureMove = false
hasTriggeredLongPress = false
hasTriggeredMassSelection = false
pressedKeyInfo = null
}