fix: Save & restore isAsciiMode after it automatically changed#2042
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #2036 by preserving the user’s prior ascii_mode state when the IME automatically forces ASCII input (e.g., password/number fields), and restoring it when returning to normal text fields.
Changes:
- Introduces a persistent
tempAsciiModefield to save the pre-auto-switch ASCII mode. - Forces
ascii_mode=truewhen switching into.ascii/numbercontexts, and restores the previously saved mode when leaving them. - Keeps the existing
resetAsciiModeOnFocusChangebehavior as a fallback when no saved state exists.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
235
to
+239
| switchKeyboard(targetKeyboard) | ||
| currentKeyboard?.let { | ||
| val isAsciiMode = rime.run { statusCached }.isAsciiMode | ||
| if (tempAsciiMode) { | ||
| if (!isAsciiMode) { | ||
| service.postRimeJob { setRuntimeOption("ascii_mode", true) } | ||
| val isAsciiMode = rime.run { statusCached }.isAsciiMode | ||
| if (targetKeyboard == ".ascii" || targetKeyboard == "number") { | ||
| if (tempAsciiMode == null) { | ||
| tempAsciiMode = isAsciiMode |
Bambooin
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request
Issue tracker
Fixes will automatically close the related issues
Fixes #2036
Feature
Save & restore
isAsciiModeafter it automatically changedCode of conduct
Code style
make sytle-lintBuild pass
make debugManually test
Code Review
Daily build
Login and download artifact at https://github.com/osfans/trime/actions
Additional Info