mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-27 11:16:03 +00:00
Unfocused view draw an inactive scrollbar
This commit is contained in:
parent
dd4d0692b2
commit
0dc079233a
@ -175,7 +175,7 @@ impl <'a> Iterator for LinesIterator<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl View for TextView {
|
impl View for TextView {
|
||||||
fn draw(&mut self, printer: &Printer, _: bool) {
|
fn draw(&mut self, printer: &Printer, focused: bool) {
|
||||||
// We don't have a focused view
|
// We don't have a focused view
|
||||||
for (i,line) in self.rows.iter().skip(self.start_line).map(|row| &self.content[row.start..row.end]).enumerate() {
|
for (i,line) in self.rows.iter().skip(self.start_line).map(|row| &self.content[row.start..row.end]).enumerate() {
|
||||||
printer.print((0,i), line);
|
printer.print((0,i), line);
|
||||||
@ -186,9 +186,11 @@ impl View for TextView {
|
|||||||
// Where ratio is ({start or end} / content.height)
|
// Where ratio is ({start or end} / content.height)
|
||||||
let start = self.view_height * self.start_line / self.rows.len();
|
let start = self.view_height * self.start_line / self.rows.len();
|
||||||
let end = self.view_height * (self.start_line + self.view_height) / self.rows.len();
|
let end = self.view_height * (self.start_line + self.view_height) / self.rows.len();
|
||||||
printer.with_style(color::HIGHLIGHT, |printer| {
|
printer.with_style(
|
||||||
printer.print_vline((printer.size.x-1, start), end-start, ' ' as u64);
|
if focused { color::HIGHLIGHT } else { color::HIGHLIGHT_INACTIVE },
|
||||||
});
|
|printer| {
|
||||||
|
printer.print_vline((printer.size.x-1, start), end-start, ' ' as u64);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user