Skip to content

Commit 05c4bc4

Browse files
committed
refactor: remove RAW_INPUT mode from ComposingTextMode
It's rarely used.
1 parent 27cbe20 commit 05c4bc4

4 files changed

Lines changed: 1 addition & 9 deletions

File tree

app/src/main/java/com/osfans/trime/core/Rime.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ class Rime :
4646
override var menuCached = RimeProto.Context.Menu()
4747
private set
4848

49-
override var rawInputCached = ""
50-
private set
51-
5249
private val dispatcher =
5350
RimeDispatcher(
5451
object : RimeDispatcher.RimeController {
@@ -263,7 +260,6 @@ class Rime :
263260
}
264261
is RimeMessage.CompositionMessage -> {
265262
compositionCached = it.data
266-
rawInputCached = getRimeRawInput()
267263
}
268264
is RimeMessage.CandidateMenuMessage -> menuCached = it.data
269265
is RimeMessage.StatusMessage -> {

app/src/main/java/com/osfans/trime/core/RimeApi.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ interface RimeApi {
2020

2121
val menuCached: RimeProto.Context.Menu
2222

23-
val rawInputCached: String
24-
2523
suspend fun isEmpty(): Boolean
2624

2725
suspend fun deploy()

app/src/main/java/com/osfans/trime/ime/core/ComposingTextMode.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ enum class ComposingTextMode(
1515
DISABLE(R.string.disable),
1616
PREEDIT(R.string.preedit),
1717
COMMIT_TEXT_PREVIEW(R.string.commit_text_preview),
18-
RAW_INPUT(R.string.raw_input),
1918
}

app/src/main/java/com/osfans/trime/ime/core/TrimeInputMethodService.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,15 +881,14 @@ open class TrimeInputMethodService : LifecycleInputMethodService() {
881881
ComposingTextMode.DISABLE -> ""
882882
ComposingTextMode.PREEDIT -> composition.preedit ?: ""
883883
ComposingTextMode.COMMIT_TEXT_PREVIEW -> composition.commitTextPreview ?: ""
884-
ComposingTextMode.RAW_INPUT -> rime.run { rawInputCached }
885884
}
886885
if (ic.getSelectedText(0).isNullOrEmpty() || text.isNotEmpty()) {
887886
ic.setComposingText(text, 1)
888887
}
889888
}
890889

891890
fun getActiveText(type: Int): String {
892-
if (type == 2) return rime.run { rawInputCached } // 當前編碼
891+
if (type == 2) return rime.run { compositionCached }.preedit ?: "" // 當前編碼
893892
var text: CharSequence? = rime.run { compositionCached }.commitTextPreview // 當前候選
894893
if (text.isNullOrEmpty()) {
895894
val info = currentInputEditorInfo

0 commit comments

Comments
 (0)