TUI: hardware cursor disappears inside plain input text after cursor movement

Open Beginner friendly
#6,890 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bun, typescript
Domain
cli, frontend

Research direction

Start with packages/tui/src/components/editor-line-render.ts and run the Bun reproduction in the issue to confirm the marker is missing at interior cursor positions. Trace how cursor cut points and the hardware marker are emitted, then check that the marker appears at all four positions with drawFakeCursor both false and true. Done when the hardware marker stays visible while moving through the prompt.

Written by the indexing model from the issue text.

Description

What happened?

With showHardwareCursor: true, moving inside the prompt hides the cursor, although editing continues at the correct position. It reappears at the start or end. This makes editing an existing prompt difficult.

Observed in OmO 5.1.57 on Linux x86_64, Kitty, tmux 3.6a, fullscreen TUI. Also reproduced directly in Senpi core at aa517922f101ab0d03bf5b5cbd37433819f085bc, without any OmO extension or terminal involved.

Steps to reproduce

  1. Set showHardwareCursor: true and tuiMode: "fullscreen".
  2. Type alpha beta gamma, then press Alt+B or Ctrl+B to move inside it.
  3. The cursor disappears. Typing still inserts at the right place; moving to the end shows it again.

Expected: the hardware cursor stays visible at every insertion position.

Minimal core reproduction from the Senpi repository root:

bun -e '
import { renderEditorLine } from "./packages/tui/src/components/editor-line-render.ts";
const marker = "\x1b_pi:c\x07";
for (const pos of [0, 6, 11, 16]) {
  const { text } = renderEditorLine({
    text: "alpha beta gamma", mentions: [], mentionStyle: s => s,
    cursor: { pos, marker, drawFakeCursor: false },
    firstGrapheme: s => Array.from(s)[0] ?? "",
  });
  console.log(pos, text.includes(marker));
}'

Actual: 0 true, 6 false, 11 false, 16 true. All four should be true. With drawFakeCursor: true, all four are true.

In packages/tui/src/components/editor-line-render.ts, cursor cut points are added only when drawing the software cursor, but the hardware marker is emitted only at a cut point. Marker placement needs to be independent of inverse-video styling.

Setting showHardwareCursor: false avoids the disappearance, but leaves a software block painted in an inactive visible tmux pane, so it is not an equivalent workaround.

Related: #571 fixes flicker/IME cursor ownership, not this missing interior marker. I found no matching open or closed report in Senpi or OmO.

AI-assisted report; the reproductions above were executed and verified locally.

Dominant language
TypeScript
Stars
517
Forks
163
Avg merge
23h 45m
Merged PRs (30d)
691

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from code-yeongyu/senpi

All issues in code-yeongyu/senpi

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.