Unfocused view draw an inactive scrollbar

This commit is contained in:
Alexandre Bury 2015-05-25 22:38:11 -07:00
parent dd4d0692b2
commit 0dc079233a

View File

@ -175,7 +175,7 @@ impl <'a> Iterator for LinesIterator<'a> {
}
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
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);
@ -186,7 +186,9 @@ impl View for TextView {
// Where ratio is ({start or end} / content.height)
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();
printer.with_style(color::HIGHLIGHT, |printer| {
printer.with_style(
if focused { color::HIGHLIGHT } else { color::HIGHLIGHT_INACTIVE },
|printer| {
printer.print_vline((printer.size.x-1, start), end-start, ' ' as u64);
});
}