Skip to content

Commit

Permalink
fix: only the candidates of the first page could be selected in popup…
Browse files Browse the repository at this point in the history
… window

feat: add `selectPagedCandidate` and `deletePagedCanidate` to new api implementation
  • Loading branch information
WhiredPlanck committed Nov 11, 2024
1 parent 14c3424 commit fafb034
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions app/src/main/java/com/osfans/trime/core/Rime.kt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ class Rime :
forgetRimeCandidate(idx).also { if (it) ipcResponseCallback() }
}

override suspend fun selectPagedCandidate(idx: Int): Boolean =
withRimeContext {
selectRimeCandidateOnCurrentPage(idx).also { if (it) ipcResponseCallback() }
}

override suspend fun deletedPagedCandidate(idx: Int): Boolean =
withRimeContext {
deleteRimeCandidateOnCurrentPage(idx).also { if (it) ipcResponseCallback() }
}

override suspend fun availableSchemata(): Array<SchemaItem> = withRimeContext { getAvailableRimeSchemaList() }

override suspend fun enabledSchemata(): Array<SchemaItem> = withRimeContext { getSelectedRimeSchemaList() }
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/osfans/trime/core/RimeApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ interface RimeApi {

suspend fun forgetCandidate(idx: Int): Boolean

suspend fun selectPagedCandidate(idx: Int): Boolean

suspend fun deletedPagedCandidate(idx: Int): Boolean

suspend fun availableSchemata(): Array<SchemaItem>

suspend fun enabledSchemata(): Array<SchemaItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CompositionPopupWindow(
updatePopupWindow(x.toInt(), y.toInt())
}
setOnSelectCandidateListener { idx ->
rime.launchOnReady { it.selectCandidate(idx) }
rime.launchOnReady { it.selectPagedCandidate(idx) }
}
}

Expand Down

0 comments on commit fafb034

Please sign in to comment.