Skip to content

Commit cca92c7

Browse files
committed
Fixed capitalization scenario when cursor is moved
1 parent 5e50fee commit cca92c7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/src/main/kotlin/com/simplemobiletools/keyboard/services/SimpleKeyboardIME.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.text.InputType.*
66
import android.text.TextUtils
77
import android.view.KeyEvent
88
import android.view.View
9+
import android.view.inputmethod.CursorAnchorInfo
910
import android.view.inputmethod.EditorInfo
1011
import android.view.inputmethod.EditorInfo.IME_ACTION_NONE
1112
import android.view.inputmethod.EditorInfo.IME_FLAG_NO_ENTER_ACTION
@@ -72,7 +73,7 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
7273
}
7374

7475
private fun updateShiftKeyState() {
75-
if (keyboard!!.mShiftState == ShiftState.ON_PERMANENT) {
76+
if (keyboard?.mShiftState == ShiftState.ON_PERMANENT) {
7677
return
7778
}
7879

@@ -258,6 +259,11 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
258259
updateShiftKeyState()
259260
}
260261

262+
override fun onUpdateCursorAnchorInfo(cursorAnchorInfo: CursorAnchorInfo?) {
263+
super.onUpdateCursorAnchorInfo(cursorAnchorInfo)
264+
updateShiftKeyState()
265+
}
266+
261267
private fun moveCursor(moveRight: Boolean) {
262268
val extractedText = currentInputConnection?.getExtractedText(ExtractedTextRequest(), 0) ?: return
263269
var newCursorPosition = extractedText.selectionStart

0 commit comments

Comments
 (0)