Skip to content

Fix selected language choice after KWrite preedit echoes - #31

Merged
RMANOV merged 1 commit into
masterfrom
fix/language-choice-selected-tab
Oct 17, 2026
Merged

RMANOV merged 1 commit into
masterfrom
fix/language-choice-selected-tab

Conversation

@RMANOV

@RMANOV RMANOV commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

When KWrite echoes visible preedit into its surrounding-text report, Core correctly invalidates the previously displayed language-choice revision. The IBus adapter could still highlight that cached offer; pressing Tab then hid the table without committing the selected word. In the actual private KWrite/Wayland reproduction, top → Down visibly selected топ, but Tab left top composing.

An explicit Up/Down now reads the current Core offer before selecting a row. Tab continues to accept only the selected revision. Changes after selection still invalidate acceptance; no Core revision rule or automatic language switching changes.

Validation:

  • Real-native regression fails on accepted 849bc3c with the missing топ commit, then passes with the adapter change.
  • All seven native test files: 285 passed; the two focused ordinary adapter files: 51 passed. Checks include each Down/Up/Down index, one commit, unchanged preedit/profile during arrows, and stale-after-selection rejection.
  • Complete ordinary Python coverage: 776 passed, two existing GI skips; exact test identities and outcomes match the accepted baseline. Four initially skipped O1 native checks were rerun against the audited module and passed.
  • Production change is eight lines in the arrow branch. Rust/PyO3 and selected-Tab handling are unchanged.

The audited native module is reused from clean 849bc3c for these isolated Python-adapter checks. Reviewed adapter source is clean commit 8ff112827c5308d3817bd38e2b92af284cb2097c. Exact-head CI run 39056416038 passed all seven jobs. Independent actual private KWrite/Wayland plus stock IBus panel verification passed for both top/топ and draftyt/драфтът: default Space preserved Latin, Down only highlighted, and Tab committed the selected alternative once and retired composition. Canonical todo and exact saved bytes also passed. Conditional physical replay in the declared Bulgarian context and copied profile produced търси в листовете todo неделя сутрин. Host runtime delivery is pending. The original progressive duplicate episode remains unverified.

@RMANOV
RMANOV marked this pull request as ready for review October 17, 2026 18:09
Copilot AI balanced review requested due to automatic review settings October 17, 2026 18:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T18:11:08.070863Z 8ff1128 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

🔵 Needs a closer look

The fix targets subtle input-method revision-leasing behavior whose real-world correctness depends on KWrite/Wayland client echo semantics that the PR itself notes are still pending GUI verification.

No open issues 🎉

What changed in this PR

This PR fixes a user-facing bug in the IBus adapter's whole-word language-choice feature. On KWrite/Wayland, when the client echoes its visible preedit back into its surrounding-text report, Core invalidates the previously displayed language-choice revision, but the adapter kept highlighting the now-stale cached offer. As a result, selecting a row (e.g. top → Down to pick топ) and pressing Tab hid the table without committing the chosen reading. The fix makes an explicit Up/Down arrow re-read the current Core offer (rebinding to its live revision) before stepping the selection, so a subsequently selected Tab accepts a valid lease.

Changes:

  • In _language_choice_key, an Up/Down arrow now calls _refresh_language_choice() to rebind the cached offer to the current Core revision before stepping, and consumes the key (returns True) if the offer was invalidated.
  • Adds native adapter tests covering Down/Up/Down selection indices, single commit, unchanged preedit/profile during arrows, and rejection of stale-after-selection Tab.
File Description
ibus/​smartkey_engine.py Arrow branch refreshes the Core language-choice offer before stepping selection, so a fresh arrow binds the live revision while selected Tab keeps its original lease.
ibus/​test_native_language_choice.py New native adapter tests simulating the KWrite preedit echo, asserting arrow selection indices, single commit, unchanged preedit/learned state, and stale-Tab rejection.

Review effort: Balanced

@RMANOV
RMANOV merged commit 8ff1128 into master Oct 17, 2026
8 checks passed
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