Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions app/src/main/java/helium314/keyboard/latin/LatinIME.kt
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,13 @@ class LatinIME : InputMethodService(),
if (needToCallLoadKeyboardLater) switcher.saveKeyboardState()
} else if (restarting) {
if (!switcher.isSecondaryViewShowing) {
switcher.resetKeyboardStateToAlphabet(currentAutoCapsState, currentRecapitalizeState)
switcher.requestUpdatingShiftState(currentAutoCapsState, currentRecapitalizeState)
if (isTransientFocusTypeNull(editorInfo)) {
switcher.resetKeyboardStateToAlphabet(Constants.TextUtils.CAP_MODE_OFF, currentRecapitalizeState)
switcher.requestUpdatingShiftState(Constants.TextUtils.CAP_MODE_OFF, currentRecapitalizeState)
} else {
switcher.resetKeyboardStateToAlphabet(currentAutoCapsState, currentRecapitalizeState)
switcher.requestUpdatingShiftState(currentAutoCapsState, currentRecapitalizeState)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ class RichInputConnection(private val mParent: InputMethodService) : PrivateComm

fun endBatchEdit() {
if (mNestLevel <= 0) {
Log.e(TAG, "Batch edit not in progress!")
mNestLevel = 0
return
}
Expand Down Expand Up @@ -447,12 +446,19 @@ class RichInputConnection(private val mParent: InputMethodService) : PrivateComm
return TextUtils.CAP_MODE_CHARACTERS and inputType
}

val text = if (InputTypeUtils.isWebEditor(mParent.currentInputEditorInfo)) {
getTextBeforeCursor(Constants.EDITOR_CONTENTS_CACHE_SIZE, 0)?.toString() ?: ""
val ei = mParent.currentInputEditorInfo
val text = if (InputTypeUtils.isWebEditor(ei)) {
val t = getTextBeforeCursor(Constants.EDITOR_CONTENTS_CACHE_SIZE, 0)
if (t == null) {
Log.d(TAG, "Setting caps mode with default fallback (text cache unavailable).")
return ei?.initialCapsMode ?: Constants.TextUtils.CAP_MODE_OFF
}
t.toString()
} else {
if (mCommittedTextBeforeComposingText.isEmpty() && mExpectedSelStart != 0) {
if (!reloadTextCache()) {
Log.d(TAG, "Setting caps mode with default fallback (text cache unavailable).")
return ei?.initialCapsMode ?: Constants.TextUtils.CAP_MODE_OFF
}
}
mCommittedTextBeforeComposingText.toString()
Expand Down
Loading