summaryrefslogtreecommitdiffstats
path: root/src/widget.rs
diff options
context:
space:
mode:
authorrabite <rabite@posteo.de>2019-01-29 18:54:13 +0100
committerrabite <rabite@posteo.de>2019-01-29 18:54:13 +0100
commitb96895a2f28e1e9fead9228617cdc02fdd1f3c31 (patch)
tree5dd4f2efeea2e3cda5eee147ab47c4a7e8e6418d /src/widget.rs
parentca521059e46ec5b9ff04bfad60284b9eb7ebcb1b (diff)
previews for directories
Diffstat (limited to 'src/widget.rs')
-rw-r--r--src/widget.rs39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/widget.rs b/src/widget.rs
index 7fc319c..db2a4f1 100644
--- a/src/widget.rs
+++ b/src/widget.rs
@@ -68,16 +68,41 @@ pub trait Widget {
)
}
- //fn get_window(&self) -> Window<Widget>;
- //fn get_window_mut(&mut self) -> &mut Window<dyn Widget>;
+ fn get_clearlist(&self) -> String {
+ let (xpos, ypos) = self.get_position().position();
+ let (xsize, ysize) = self.get_size().size();
+
+ let mut clearcmd = String::from("");
+ for line in ypos..ysize {
+ clearcmd += &format!("{}{:xsize$}",
+ crate::term::goto_xy(xpos, line),
+ " ",
+ xsize=xsize as usize);
+ }
+
+ clearcmd
+ }
- //fn run(&mut self) {
- // self.draw();
- // self.handle_input();
- //}
+ fn get_redraw_empty_list(&self, lines: usize) -> String {
+ let (xpos, ypos) = self.get_position().position();
+ let (xsize, ysize) = self.get_size().size();
+
+ let mut output = String::new();
+
+ if ysize as usize > lines {
+ let start_y = lines + 1 + ypos as usize;
+ for i in start_y..(ysize+2) as usize {
+ output += &format!("{}{:xsize$}",
+ crate::term::goto_xy(xpos,i as u16),
+ " ",
+ xsize = xsize as usize);
+ }
+ }
+
+ output
+ }
- //fn get_buffer(&self) -> &Vec<String>;
fn refresh(&mut self);
fn get_drawlist(&self) -> String;
}