Skip to content

fix: Save & restore isAsciiMode after it automatically changed#2042

Merged
goofyz merged 1 commit into
osfans:developfrom
goofyz:fix-2036
Jul 7, 2026
Merged

fix: Save & restore isAsciiMode after it automatically changed#2042
goofyz merged 1 commit into
osfans:developfrom
goofyz:fix-2036

Conversation

@goofyz

@goofyz goofyz commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Pull request

Issue tracker

Fixes will automatically close the related issues

Fixes #2036

Feature

Save & restore isAsciiMode after it automatically changed

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 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 tempAsciiMode field to save the pre-auto-switch ASCII mode.
  • Forces ascii_mode=true when switching into .ascii / number contexts, and restores the previously saved mode when leaving them.
  • Keeps the existing resetAsciiModeOnFocusChange behavior 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
@goofyz goofyz merged commit 71d61a0 into osfans:develop Jul 7, 2026
4 checks passed
@goofyz goofyz deleted the fix-2036 branch July 7, 2026 15:20
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