Skip to content

fix(renderer): use view height before first flush - #1766

Open
fzlzjerry wants to merge 2 commits into
charmbracelet:mainfrom
fzlzjerry:fix/1740-insert-above-before-first-flush
Open

fix(renderer): use view height before first flush#1766
fzlzjerry wants to merge 2 commits into
charmbracelet:mainfrom
fzlzjerry:fix/1740-insert-above-before-first-flush

Conversation

@fzlzjerry

Copy link
Copy Markdown

Fixes #1740.

Before

Create an 80x24 renderer, render a one-line inline view, and call insertAbove before the first flush. The cell buffer still has the terminal height at that point, so the renderer emits ESC[24B and scrolls the viewport.

After

Before the first inline flush, insertAbove calculates its cursor movement from the current view height. Once a view has been flushed, it continues using the cell buffer height so the cursor math stays tied to what is actually on screen. Alt-screen behavior is unchanged.

The regression test exercises the pre-flush call order directly and verifies the complete output sequence for a one-line view.

Tests

Copilot AI lite review requested due to automatic review settings August 13, 2026 19:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@andrinoff andrinoff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!, please fix the comment below! Nice catch!

Comment thread cursed_renderer.go Outdated
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.46%. Comparing base (351d215) to head (40bf5ab).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1766      +/-   ##
==========================================
+ Coverage   56.50%   58.46%   +1.96%     
==========================================
  Files          25       25              
  Lines        1315     1317       +2     
==========================================
+ Hits          743      770      +27     
+ Misses        482      453      -29     
- Partials       90       94       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andrinoff
andrinoff self-requested a review August 14, 2026 07:46

@andrinoff andrinoff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, meant to request changes

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v2] tea.Printf/Println before the first flush emits a full-terminal-height cursor-down (scrolls the whole screen)

3 participants