Do not draw scrollbar when not needed, draw background behind scrollbar
This commit is contained in:
parent
ccec8e813b
commit
49149c3e17
2 changed files with 55 additions and 40 deletions
|
|
@ -242,16 +242,20 @@ impl Terminal {
|
|||
));
|
||||
}
|
||||
|
||||
pub fn scrollbar(&self) -> (f32, f32) {
|
||||
pub fn scrollbar(&self) -> Option<(f32, f32)> {
|
||||
let term = self.term.lock();
|
||||
let grid = term.grid();
|
||||
let total = grid.history_size() + grid.screen_lines();
|
||||
let start = total - grid.display_offset() - grid.screen_lines();
|
||||
let end = total - grid.display_offset();
|
||||
(
|
||||
(start as f32) / (total as f32),
|
||||
(end as f32) / (total as f32),
|
||||
)
|
||||
if grid.history_size() > 0 {
|
||||
let total = grid.history_size() + grid.screen_lines();
|
||||
let start = total - grid.display_offset() - grid.screen_lines();
|
||||
let end = total - grid.display_offset();
|
||||
Some((
|
||||
(start as f32) / (total as f32),
|
||||
(end as f32) / (total as f32),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update(&mut self) -> bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue