Remove superfluous current screen title

This commit is contained in:
KoffeinFlummi
2019-04-23 01:39:30 +02:00
parent 82e1e3d1c2
commit d750e5a46f

View File

@@ -23,7 +23,6 @@ struct Screen {
pub struct Layout {
views: HashMap<String, Screen>,
title: String,
statusbar: Box<dyn View>,
focus: Option<String>,
pub cmdline: EditView,
@@ -45,7 +44,6 @@ impl Layout {
Layout {
views: HashMap::new(),
title: String::new(),
statusbar: status.as_boxed_view(),
focus: None,
cmdline: EditView::new().filler(" ").style(style),
@@ -73,7 +71,6 @@ impl Layout {
view: view.as_boxed_view_ext(),
};
self.views.insert(s.clone(), screen);
self.title = title.to_owned();
self.focus = Some(s);
}
@@ -89,8 +86,6 @@ impl Layout {
pub fn set_view<S: Into<String>>(&mut self, id: S) {
let s = id.into();
let title = &self.views[&s].title;
self.title = title.clone();
self.focus = Some(s);
self.cmdline_focus = false;
self.screenchange = true;
@@ -131,15 +126,16 @@ impl View for Layout {
cmdline_height += 1;
}
// screen title
printer.with_color(ColorStyle::title_primary(), |printer| {
let offset = HAlign::Center.get_offset(self.title.width(), printer.size.x);
printer.print((offset, 0), &self.title);
});
// screen content
if let Some(ref id) = self.focus {
let screen = &self.views[id];
// screen title
printer.with_color(ColorStyle::title_primary(), |printer| {
let offset = HAlign::Center.get_offset(screen.title.width(), printer.size.x);
printer.print((offset, 0), &screen.title);
});
// screen content
let printer = &printer
.offset((0, 1))
.cropped((printer.size.x, printer.size.y - 3 - cmdline_height))