Merge pull request #697 from FreddyFunk/fix/unfocused-cursor-scroll
fix: hide cursor when scrolled in unfocused terminal
This commit is contained in:
commit
17b830c74c
1 changed files with 65 additions and 56 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue