You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix scroll() to respect left/right margins (DECSLRM) (#434)
* Fix scroll() to respect left/right margins (DECSLRM)
When margin mode is active with narrowed left/right margins, the scroll()
function was scrolling entire lines instead of only the columns within
the margin region. This caused display corruption when applications like
tmux use DECSLRM for side-by-side panes - scrolling in one pane would
affect content in adjacent panes.
The fix adds a new code path that detects when:
1. Margin mode is enabled (DECLRMM)
2. Margins are narrower than full width
3. Cursor is within the margin region
In this case, we do in-place column-by-column scrolling within the
margin bounds, similar to how cmdInsertLines/cmdDeleteLines already
handle this scenario. The isWrapped flag is cleared on the bottom line
since partial-line scrolling breaks line continuity.
When margins are full width or cursor is outside margins, normal
scrollback behavior is preserved.
* Add margin checks to cmdIndex and reverseIndex
Both functions now respect left/right margins (DECSLRM) like
cmdLineFeedBasic already does:
- cmdIndex (ESC D): Only scroll if cursor is within margin columns
- reverseIndex (ESC M): Only scroll if cursor is within margin columns,
and do column-wise scrolling for narrow margins
This fixes intermittent display corruption in tmux side-by-side panes
where Index or Reverse Index commands could affect content outside
their margin boundaries.
---------
Co-authored-by: Mike Manzano <mike@clicketyclacks.co>
if !buffer.lines.shiftElements(start: startIndex, count: scrollRegionHeight, offset:1){
5462
-
print("Assertion on reverseIndex, state was: y=\(buffer.y) scrollTop=\(buffer.scrollTop) yDisp=\(buffer.yDisp) linesTop=\(buffer.linesTop) isAlternate=\(isCurrentBufferAlternate)")
5518
+
// Shift content down within the margin columns (reverse of scroll)
if !buffer.lines.shiftElements(start: topRow, count: scrollRegionHeight, offset:1){
5538
+
print("Assertion on reverseIndex, state was: y=\(buffer.y) scrollTop=\(buffer.scrollTop) yDisp=\(buffer.yDisp) linesTop=\(buffer.linesTop) isAlternate=\(isCurrentBufferAlternate)")
0 commit comments