Auto-snap child viewport to bottom when typing into scrollback
Typing into a focused child while its emulator viewport was scrolled up left the keystroke heading to the PTY but the input box invisible below the visible region — it looked like typing did nothing. processStdin's flushForward now sets pendingViewportBottom whenever bytes are actually injected, so the existing post-loop handler snaps the viewport and repaints. Wheel events and Ctrl-B paths are untouched: both are intercepted before reaching forward, so wheel still scrolls into history and Ctrl-B is still the explicit escape hatch. Only bytes that would actually reach the child PTY trigger the snap.
This commit is contained in:
@@ -1323,6 +1323,15 @@ func (st *uiState) processStdin(chunk []byte) {
|
||||
}
|
||||
|
||||
forward := make([]byte, 0, len(chunk))
|
||||
|
||||
var pendingAction *paletteAction
|
||||
var pendingNav navEntry
|
||||
var pendingRestartID string
|
||||
var pendingViewportDelta int
|
||||
var pendingViewportBottom bool
|
||||
var pendingPadStep int
|
||||
var pendingPadExit bool
|
||||
|
||||
flushForward := func() {
|
||||
if len(forward) == 0 {
|
||||
return
|
||||
@@ -1337,19 +1346,16 @@ func (st *uiState) processStdin(chunk []byte) {
|
||||
if prev != OwnerUser {
|
||||
go st.drawStatusLine()
|
||||
}
|
||||
// Auto-snap the emulator viewport to the live area
|
||||
// on any forwarded keystroke. Without this, typing
|
||||
// while scrolled into history leaves the cursor /
|
||||
// echoed bytes off-screen below the visible region.
|
||||
pendingViewportBottom = true
|
||||
}
|
||||
}
|
||||
forward = forward[:0]
|
||||
}
|
||||
|
||||
var pendingAction *paletteAction
|
||||
var pendingNav navEntry
|
||||
var pendingRestartID string
|
||||
var pendingViewportDelta int
|
||||
var pendingViewportBottom bool
|
||||
var pendingPadStep int
|
||||
var pendingPadExit bool
|
||||
|
||||
// childOnPrimary captures whether the focused child is on its primary
|
||||
// screen at the start of this chunk. Wheel events on the primary
|
||||
// screen scroll the emulator viewport (inline scrollback); on the
|
||||
|
||||
Reference in New Issue
Block a user