Skip to content

Bug: input prompt clips the last character of a line whose width exactly matches the prompt width #26212

Description

@pmenic

Summary

When the input line fills the prompt width exactly and the user keeps typing, the new character + cursor become invisible. The buffer is correct — pressing Enter submits the full text including the invisible suffix — so this is a pure rendering issue.

Environment

  • Gemini CLI: 0.39.1
  • OS: Windows 11
  • Shell: PowerShell (Windows Terminal)
  • Terminal size: 50 columns × 5 rows
  • Plan mode active
  • ui.terminalBuffer: true in ~/.gemini/settings.json

Reproduction

  1. Resize the terminal to ~50 columns (the exact width is not critical, only that the test string ends up matching inputWidth).
  2. At the input prompt type parola repeatedly until the line is full, then continue with pa. The cursor sits at the right edge.
  3. Type one more character (e.g. r).

Expected

The prompt grows to a second visual line and shows par plus the cursor on it.

Observed

The new character and cursor disappear; the visible line still ends with pa. The text is in the buffer — Enter submits the full string parola parola parola parola parola parola parola par.

Root cause

VirtualizedList (used by ScrollableList to render the input lines when ui.terminalBuffer: true) applies paddingRight: 1 for its scroll gutter (packages/cli/src/ui/components/shared/VirtualizedList.tsx:738). The input prompt was passing width={inputWidth} to ScrollableList (packages/cli/src/ui/components/InputPrompt.tsx:1865), so the inner content area was inputWidth - 1. A visual line exactly inputWidth chars wide had its last char clipped.

Fix

Compensate for the gutter by passing width={inputWidth + 1} to ScrollableList, so the inner content area equals inputWidth. The fix is staged on branch fix/inputprompt-wrap-truncates-last-char on my fork (commit e9f20f206) with a regression test; I'll open the PR once one of my existing open PRs is reviewed/merged.

Notes

  • Only the ui.terminalBuffer: true render path is affected. The fallback render path (InputPrompt.tsx:1875-1891) does not go through VirtualizedList and renders correctly.

Metadata

Metadata

Assignees

Labels

area/coreIssues related to User Interface, OS Support, Core Functionalityeffort/small1 day or less: trivial logic, UI adjustments, docskind/bugpriority/p2Important but can be addressed in a future release.status/bot-triaged

Type

Projects

Status
Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions