Skip to content

Conversation

@WhiredPlanck
Copy link
Collaborator

Pull request

Issue tracker

Fixes will automatically close the related issues

Fixes # N/A

Feature

Describe features of this pull request

Code of conduct

Code style

Build pass

  • make debug

Manually test

  • Done

Code Review

  1. No wildcards import
  2. Manual build and test pass
  3. GitHub Action CI pass
  4. At least one contributor review and approve
  5. Merged clean without conflicts
  6. PR will be merged by rebase upstream base

Daily build

Login and download artifact at https://github.com/osfans/trime/actions

Additional Info

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the candidate highlighting system by moving the computation of the global highlighted candidate index from Kotlin to native C++ code. Previously, the highlighted index was calculated on the Kotlin side by combining the page-local index with page number and size. Now, the native rime_get_highlighted_candidate_index function directly returns the global index from the Rime session's segment.

Key changes:

  • Added native rime_get_highlighted_candidate_index() function that retrieves the global highlighted candidate index directly from the Rime context
  • Updated getBulkCandidates() to return a 3-tuple (size, highlighted index, candidates) instead of 2-tuple
  • Removed the globalHighlightedIdx property and its calculation from RimeApi and Rime classes

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
app/src/main/jni/librime_jni/proto.h Adds declaration for new native function rime_get_highlighted_candidate_index
app/src/main/jni/librime_jni/proto.cc Implements rime_get_highlighted_candidate_index to retrieve the global highlighted index from the Rime session
app/src/main/jni/librime_jni/rime_jni.cc Updates getBulkCandidates() to return 3-tuple including highlighted index, and JNI bridge to marshal the additional parameter
app/src/main/java/com/osfans/trime/core/RimeMessage.kt Adds highlighted field to CandidateListMessage.Data class and updates deserialization to handle 3-element array
app/src/main/java/com/osfans/trime/core/RimeApi.kt Removes globalHighlightedIdx property from interface
app/src/main/java/com/osfans/trime/core/Rime.kt Removes globalHighlightedIdx property and its calculation from paged menu data
app/src/main/java/com/osfans/trime/ime/candidates/compact/CompactCandidateModule.kt Updates destructuring to receive highlighted index from the data object instead of querying Rime

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@WhiredPlanck WhiredPlanck merged commit ecdf9f3 into osfans:develop Dec 16, 2025
9 checks passed
@WhiredPlanck WhiredPlanck deleted the candidate-highlight-20251216 branch December 16, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants