Skip to content

Refactor keyboard action handling and improve text parsing - #2060

Merged
WhiredPlanck merged 6 commits into
osfans:developfrom
WhiredPlanck:key-event
Aug 1, 2026
Merged

Refactor keyboard action handling and improve text parsing#2060
WhiredPlanck merged 6 commits into
osfans:developfrom
WhiredPlanck:key-event

Conversation

@WhiredPlanck

Copy link
Copy Markdown
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

Copilot AI left a comment

Copy link
Copy Markdown

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 keyboard key/action handling by replacing the previous Keycode enum-based mapping with a new KeyCode utility and a KeyActionToken model, while extending generated RimeKeyMapping helpers to support synthetic codes for uppercase letters and symbols.

Changes:

  • Add synthetic keycode ranges (uppercase + symbols) and lookup helpers to the generated RimeKeyMapping.
  • Introduce KeyCode and migrate parsing/display-label logic away from the removed ime/enums/Keycode.kt.
  • Update theme YAML preset key send values to match the new keycode/name handling.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
codegen/src/main/java/com/osfans/trime/codegen/GenKeyMapping.kt Extends generated mapping with synthetic code offsets and new lookup/query functions.
app/src/main/java/com/osfans/trime/ime/keyboard/KeyCode.kt New keycode/name parsing and display-label logic replacing Keycode enum utilities.
app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardActionListener.kt API adjustment (removes onRelease, renames onText parameter).
app/src/main/java/com/osfans/trime/ime/keyboard/Keyboard.kt Updates clickability checks to align with nullable click tokens.
app/src/main/java/com/osfans/trime/ime/keyboard/KeyAction.kt Migrates KeyAction construction/parsing to KeyActionToken and KeyCode.
app/src/main/java/com/osfans/trime/ime/keyboard/Key.kt Adjusts behavior/action map construction for nullable tokens.
app/src/main/java/com/osfans/trime/ime/keyboard/CommonKeyboardActionListener.kt Refactors key event mapping and text tokenization for simulated sequences.
app/src/main/java/com/osfans/trime/ime/enums/Keycode.kt Removes the old enum-based keycode mapping implementation.
app/src/main/java/com/osfans/trime/data/theme/model/TextKeyboard.kt Switches click/behavior action fields to KeyActionToken? and decodes accordingly.
app/src/main/java/com/osfans/trime/data/theme/model/KeyActionToken.kt Adds a new Parcelable token model for scalar vs inline-mapping actions.
app/src/main/java/com/osfans/trime/data/theme/KeyActionManager.kt Updates cache keys and overloads to support KeyActionToken.
app/src/main/assets/shared/trime.yaml Updates preset key send values to new names (e.g. FUNCTION/SWITCH_CHARSET/SEARCH).
app/src/main/assets/shared/tongwenfeng.trime.yaml Same preset key send normalization as shared config.
app/src/test/assets/trime.yaml Mirrors shared YAML send updates for test assets.

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

Comment thread codegen/src/main/java/com/osfans/trime/codegen/GenKeyMapping.kt
@WhiredPlanck

WhiredPlanck commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

The changes in this PR have verified in the community. Everything looks fine.

@WhiredPlanck
WhiredPlanck merged commit 3548724 into osfans:develop Aug 1, 2026
4 checks passed
@WhiredPlanck
WhiredPlanck deleted the key-event branch August 1, 2026 12:04
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.

3 participants