Merge pull request #697 from FreddyFunk/fix/unfocused-cursor-scroll

fix: hide cursor when scrolled in unfocused terminal
This commit is contained in:
Levi Portenier 2026-02-03 11:57:53 -07:00 • committed by GitHub
commit 17b830c74c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -720,9 +720,17 @@ where
state.scrollbar_rect.set(Rectangle::default()) state.scrollbar_rect.set(Rectangle::default())
} }
// Draw cursor // Draw cursor (only when not scrolled, as cursor is at bottom of active area)
{ {
let cursor = terminal.term.lock().renderable_content().cursor; let term = terminal.term.lock();
let display_offset = term.grid().display_offset();
let cursor = term.renderable_content().cursor;
drop(term);
// Skip drawing cursor when scrolled - the cursor is below the visible viewport
if display_offset > 0 {
// Cursor is off-screen when scrolled up
} else {
let col = cursor.point.column.0; let col = cursor.point.column.0;
let line = cursor.point.line.0; let line = cursor.point.line.0;
let color = terminal.term.lock().colors()[NamedColor::Cursor] let color = terminal.term.lock().colors()[NamedColor::Cursor]
@ -782,6 +790,7 @@ where
CursorShape::Block | CursorShape::Hidden => {} // Block is handled seperately CursorShape::Block | CursorShape::Hidden => {} // Block is handled seperately
} }
} }
}
let duration = instant.elapsed(); let duration = instant.elapsed();
log::trace!("redraw {}, {}: {:?}", view_w, view_h, duration); log::trace!("redraw {}, {}: {:?}", view_w, view_h, duration);