Skip to content

line_number gutter stops displaying line numbers beyond line 99 #452

@PersistenceOS

Description

@PersistenceOS

Bug Report: line_number Component Stops Rendering at Line 99

Issue Summary

The line_number component from @opentui/core v0.1.63 stops rendering line numbers in the gutter at line 99, even when the wrapped textarea contains 100+ lines. Line numbers beyond 99 are not displayed in the gutter, though the textarea content scrolls correctly.

Environment

  • Package: @opentui/core
  • Version: 0.1.63
  • Framework: @opentui/solid v0.1.63
  • OS: Windows 10/11
  • Terminal: PowerShell / Linux terminals

Steps to Reproduce

  1. Create a file with more than 99 lines of content
  2. Wrap a textarea component with line_number component
  3. Set showLineNumbers={true}
  4. Observe the gutter - line numbers stop displaying at line 99

Expected Behavior

Line numbers should display for ALL lines in the file (1, 2, 3, ..., 99, 100, 101, 102, ...), regardless of file size.

Actual Behavior

Line numbers display correctly for lines 1-99, but stop rendering at line 99. Lines 100+ do not show line numbers in the gutter, even though:

  • The textarea content scrolls correctly
  • The file content is accessible
  • Cursor position tracking works correctly (status bar shows correct line numbers like "Ln 274")

Code Example

import { line_number } from "@opentui/core"
import { TextareaRenderable } from "@opentui/core"

// File with 274 lines
const fileContent = "line 1\nline 2\n...\nline 274"

<line_number
  fg={theme.textMuted}
  bg={theme.backgroundElement}
  minWidth={5}
  paddingRight={1}
  showLineNumbers={true}
>
  <textarea
    textColor={theme.text}
    initialValue={fileContent}
  />
</line_number>

Result: Gutter shows line numbers 1-99, but stops at 99. Lines 100-274 have no line numbers displayed.

Additional Context

  • The minWidth prop is set correctly (5 for 3-digit numbers)
  • The lineColors and lineSigns props work correctly for lines 1-99
  • Status bar calculations (using our own logic) correctly show line numbers beyond 99
  • The textarea itself handles 100+ lines correctly - only the gutter rendering is affected
  • This appears to be a hardcoded limit or rendering bug in the component

Workaround Attempted

We attempted to create a custom line number gutter, but it doesn't sync scroll position with the textarea, making it unusable. The line_number component's automatic scroll synchronization is essential for proper editor functionality.

Impact

This bug affects any editor implementation using line_number with files containing 100+ lines, which is common in real-world codebases.

Related

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