Skip to content

fix(textfield): no horizontal scroll — text overflows boundary, cursor unreachable #212

Description

@kolkov

Bug

TextField has no horizontal scroll offset. When text exceeds the field width:

  • Text overflows past the right boundary (no clipping or clipping without scroll)
  • Cursor disappears beyond the visible area
  • Arrow keys cannot bring cursor back into view

Reproduce

  1. go run ./examples/gallery/
  2. Click TextField
  3. Type a long string until it exceeds field width
  4. Cursor becomes unreachable, text overflows

Expected

When cursor reaches the right edge, text origin shifts left to keep cursor visible (horizontal scroll offset). Standard behavior in all text fields (HTML input, Flutter TextField, Qt QLineEdit).

Implementation

TextField needs a scrollOffsetX float32 field that adjusts when:

  • Cursor moves past right edge → shift text left
  • Cursor moves past left edge → shift text right
  • Text deleted → adjust offset to remove empty space

DrawText and CursorX must account for scrollOffsetX. ContentRect clips the overflow.

Enterprise reference: Flutter's EditableTextState._showCaretOnScreen() + RenderEditable.showCursor.

Environment

  • All backends, all themes
  • v0.1.50+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions