Skip to content

cursor: Left over a CJK glyph moves two cells in antigravity-cli #2995

Closed as not planned

Description

@Xuepoo

Priority: P2 | Area: render | Labels: bug,P2,area:render | Milestone: v0.1.0 | RFC: none | Task: none

Reported on 0.0.35 in antigravity-cli (agy), with CJK text in an input field:

  • pressing End puts the cursor after the last character, which is correct;
  • pressing Left once then moves the cursor two cells left instead of one, so it lands on the last character's lead cell rather than on the character before it; subsequent Left presses move one cell at a time.

The reporter also notes the cursor "never displays on the last character" while typing CJK, and that the block looks application-drawn.

Why this needs a decision rather than a guess

Skipping a wide character's spacer cell on a horizontal move is what xterm does, so Bitty may be correct and the application may be computing the column with a width table that treats CJK as one cell. The two readings need different fixes, so the first step is a headless reproduction against bitty-term-state (print 中, CUP/CUF, then Left) plus a check of what column the application actually requests (bitty ctl terminal text and a CSI trace).

Acceptance

  • A test pins the intended Left/Right behaviour over a wide glyph, including the pending-wrap column.
  • If the application is at fault, the behaviour is documented (a note in the manual's troubleshooting page) and this issue closes as upstream; if Bitty is at fault, the cursor lands where the application asked.

Activity

  1. added this to the v0.1.0 milestone on Nov 7, 2026
  2. added
    bug
    area:render
    P2
    on Nov 7, 2026
  3. Xuepoo commented on Nov 8, 2026

    @Xuepoo
    ContributorAuthor

    Closing as not a Bitty defect: the behaviour is xterm-compatible, and the confusing part is an application width table.

    Terminal columns are cells, not characters. A wide glyph owns a lead cell and a spacer cell, and the cursor can only rest on the lead, so Left from after a wide glyph moves two columns. The repository pins exactly that:

    • cursor_move_snaps_off_a_spacer_without_extra_steps (crates/bitty-term-state/src/state/tests.rs:1221) — CUF 2 over a wide pair lands on the pair lead, and a target that lands on a spacer snaps back to the lead.
    • wide_rtl_block_underline_and_bar_cover_the_painted_glyph (crates/bitty-runtime/src/runtime/present.rs) — a block cursor on a wide glyph paints both cells (rect.width == 16 for an 8 px cell), so it covers the whole character rather than its left half.

    So the reported "Left moves two cells, then normal" is the expected spacer skip; the "cursor never shows on the last character" is the block covering a two-cell glyph.

    The residual difference is application-side: a TUI that computes its own cursor column from a width table treating CJK as one cell lags by one cell per wide character, while one that positions the cursor with CUP/CUF does not. Documented for users in bitty-manual#113 (45735382-series), section "The cursor looks one cell off beside CJK or emoji" (en + zh-CN), including a one-line comparison test against a plain shell prompt.

    If the offset also appears with pure ASCII text or in a prompt positioned by CUP, reopen with that case — that would be a real terminal bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:renderbug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions