Skip to content

fix(tui): correct IME cursor placement#714

Open
yc1121 wants to merge 1 commit into
MoonshotAI:mainfrom
yc1121:fix-ime-cursor
Open

fix(tui): correct IME cursor placement#714
yc1121 wants to merge 1 commit into
MoonshotAI:mainfrom
yc1121:fix-ime-cursor

Conversation

@yc1121

@yc1121 yc1121 commented Jun 13, 2026

Copy link
Copy Markdown

Related Issue

Resolve #712

Problem

See linked issue. In WezTerm and Alacritty, Chinese IME candidate windows were not anchored to the editor cursor. Enabling the hardware cursor fixed candidate placement, but also exposed a double cursor in the main terminal editor.

What changed

Enabled the TUI hardware cursor so terminal IME candidate windows can follow the editor cursor. The main editor now removes the rendered fake cursor when the hardware cursor marker is present, avoiding the double-width cursor while preserving IME positioning.

Added regression coverage for hardware cursor initialization and editor cursor rendering.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jun 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4de495d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4de495dd95

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

const wrapped = wrapWithSideBorders(lines, (s) => this.borderColor(s), {
connectedAbove: this.connectedAbove && !this.borderHighlighted,
});
return wrapped.map(removeFakeCursorAtHardwareMarker);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Strip the fake cursor before slash highlighting

When the editor text starts with a slash command and the cursor is at the end of the command token (for example after typing / or /help), highlightFirstSlashToken runs before this post-processing and treats CURSOR_MARKER as part of the token, inserting its SGR reset between the marker and pi-tui's \u001B[7m fake cursor. removeFakeCursorAtHardwareMarker then no-ops because the marker is no longer immediately followed by \u001B[7m, so the inverse fake cursor remains exactly in the slash-command path where hardware cursor mode should remove it. Move the fake-cursor stripping before slash highlighting or make the highlighter ignore the marker.

Useful? React with 👍 / 👎.

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.

[BUG] 在Alacritty和wezterm中输入中文时,候选框会出现在终端外

1 participant