Skip to content

chewing: press Up in the composition to choose another tone - #928

Open
DaveTseng2019 wants to merge 3 commits into
EasyIME:masterfrom
DaveTseng2019:feat/chewing-tone-menu
Open

DaveTseng2019 wants to merge 3 commits into
EasyIME:masterfrom
DaveTseng2019:feat/chewing-tone-menu

Conversation

@DaveTseng2019

@DaveTseng2019 DaveTseng2019 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

When a character comes out in the wrong tone (typed ㄅㄧˋ, meant ㄅㄧˊ), the only fix today is to delete it and type it again. In the composition, with no candidate window and no bopomofo being typed, Up does nothing (libchewing's handle_Up only closes a candidate list), so this PR uses Up to open a tone menu.

Builds on #1019 (apply customizeUI before the candidate list), split out of this PR as a separate fix; its commit shows here until it is merged.

  • chewing: add ToneMenu (tone_menu.py). open() lists the other tones of the character at the cursor that have characters, e.g. ㄅㄧˊ 鼻, first tone to neutral. choose() replaces the character: libchewing has no API to change one syllable, so it deletes the character, types the new syllable on the default layout and puts the cursor back; if the new syllable cannot be typed, it types the old one back. A second, hidden ChewingContext does the lookups, so the user's dictionary is never touched.
  • chewing: Up opens the menu in the candidate window, one tone per row; the normal layout comes back when it closes. A selection key or Enter changes the tone, arrows move, any other key closes it. It also closes when the IME is deactivated or the composition ends.

Rebased on current master. New file headers follow the AGENTS.md rules.

Testing: tests/test_chewing_tone_menu.py, 8 tests, all pass with the bundled 32-bit python (5 of them load chewing.dll and use the Hsu layout to check a non-default layout; two guard bugs found while testing). Also built x86/x64 and tested by hand with 新酷音 (Hsu layout): ㄅㄧˋ ㄅㄧㄝˊ → 必別, Up on 必 lists ㄅㄧ / ㄅㄧˊ / ㄅㄧˇ, choosing ㄅㄧˊ gives 鼻別 with the cursor in place, Esc closes without a change.

Open question: braille_chewing subclasses ChewingTextService, so it gets this menu too. The menu is visual; please say if it should be turned off there.

Architecture and design by Dave Tseng. Implementation generated with AI assistance from Claude Code (Claude Opus 5.5).

🤖 Generated with Claude Code

@PCMan PCMan closed this Oct 16, 2026
@PCMan PCMan reopened this Oct 16, 2026
@PCMan

PCMan commented Oct 17, 2026

Copy link
Copy Markdown
Member

Hi @DaveTseng2019, thank you for your contribution!

Currently, I am focused on resolving several critical stability and IPC issues in the core framework. Because of this, pull requests introducing new features are temporarily on hold and will be reviewed once the stability fixes are complete. Thank you for your patience and understanding!


感謝你的貢獻與 PR!

目前我正專注於修復核心架構與各項穩定性問題(Bug fixes),因此新功能的 PR 會在穩定性問題解決告一段落後再陸續進行審核,感謝你的耐心與體諒!

DaveTseng2019 and others added 3 commits October 30, 2026 13:15
A backend that changes the layout (e.g. candPerRow) together with a
new list got the list drawn with the old layout; the change only
showed on the next update. Applying UI settings first lets one reply
do both.

- In updateStatus(), handle "customizeUI" before the candidate list,
  composition and commit string instead of last.

Architecture and design by Dave Tseng. Implementation generated with AI assistance from Claude Code (Claude Opus 5.5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a character comes out in the wrong tone, today the user has to
delete it and type it again. The next commit opens this menu with Up.

- New tone_menu.py. ToneMenu.open() lists the other tones of the
  character at the cursor that have characters, e.g. "ㄅㄧˊ 鼻";
  choose() replaces the character with the chosen tone.
- libchewing has no API to change one syllable, so choose() deletes the
  character and types the new syllable on the default layout, then puts
  the cursor back. If the new syllable cannot be typed, it types the old
  one back.
- A second, hidden ChewingContext looks up each tone's characters, so
  the user's dictionary is never touched.
- Unit tests for the key mapping and tone order, plus tests against the
  bundled chewing.dll (skipped outside the 32-bit bundled python).

Architecture and design by Dave Tseng. Implementation generated with AI assistance from Claude Code (Claude Opus 5.5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Up did nothing in this state, so it is free. Users asked for a quick
way to fix a wrong tone without deleting and retyping the character.

- Up, with no candidate window and no bopomofo being typed, opens the
  tone menu for the character at the cursor in the candidate window,
  one tone per row from the first tone to the neutral tone.
- In the menu: a selection key or Enter changes the tone; arrow keys
  move the cursor; any other key closes the menu and restores the
  normal candidates per row.
- Close the menu when the IME is deactivated or the composition ends.

Architecture and design by Dave Tseng. Implementation generated with AI assistance from Claude Code (Claude Opus 5.5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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