Skip to content
Myr

chore: revert "fix: cursor position adjustment after exiting alt screen (#1241)"

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This reverts commit 4ad07926d7ff00bc21a05b2536d82a7cc629225e.

authored by Ayman Bagabas · committed by Ayman Bagabas · parent 4ad0792 · Browse files · 1 file+0 added−19 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+0 added−19 removed

  • other:+0 added−19 removed

1 file+0 added−19 removed

modified:standard_renderer.go-19 removed
55 unmodified lines
56 height int5758 // lines explicitly set not to render59 ignoreLines map[int]struct{}6061 // lines rendered before entering alt screen mode62 linesRenderedBeforeAltScreen int60}6162// newRenderer creates a new renderer. Normally you'll want to initialize it63// with os.Stdout as the first argument.
269 unmodified lines
333334 r.altScreenActive = true335 r.execute(ansi.EnableAltScreenBuffer)336340 // Save the current line count before entering the alternate screen mode.341 // This allows us to compare and adjust the cursor position when exiting the alternate screen.342 r.linesRenderedBeforeAltScreen = r.linesRendered343337 // Ensure that the terminal is cleared, even when it doesn't support338 // alt screen (or alt screen support is disabled, like GNU screen by339 // default).340 //
24 unmodified lines
365366 r.altScreenActive = false367 r.execute(ansi.DisableAltScreenBuffer)368376 // Adjust cursor and screen377 if r.linesRendered < r.linesRenderedBeforeAltScreen {378 // If fewer lines were rendered in the alternate screen, move the cursor up379 // to align with the previous normal screen position and clear any remaining lines.380 r.execute(ansi.CursorUp(r.linesRenderedBeforeAltScreen - r.linesRendered))381 r.execute(ansi.EraseScreenBelow)382 } else if r.linesRendered > r.linesRenderedBeforeAltScreen && r.linesRenderedBeforeAltScreen > 0 {383 // If more lines were rendered in the alternate screen, move the cursor down384 // to align with the new position.385 r.execute(ansi.CursorDown(r.linesRendered - r.linesRenderedBeforeAltScreen))386 }387369 // cmd.exe and other terminals keep separate cursor states for the AltScreen370 // and the main buffer. We have to explicitly reset the cursor visibility371 // whenever we exit AltScreen.372 if r.cursorHidden {
395 unmodified lines