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