summaryrefslogtreecommitdiffstats
path: root/src/widget.rs
diff options
context:
space:
mode:
authorrabite <rabite@posteo.de>2019-02-25 18:23:48 +0100
committerrabite <rabite@posteo.de>2019-02-25 19:06:26 +0100
commit7fc77f8605bf637331f2f9c283c4b4e284891af1 (patch)
tree62d2c03d60a2b2ea048e6f68fda93b39ed4a0ce2 /src/widget.rs
parenta6c147442c508631df3b862a8d9b3d618ccfb339 (diff)
minibuffer Widgetified
Diffstat (limited to 'src/widget.rs')
-rw-r--r--src/widget.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/widget.rs b/src/widget.rs
index ccf8f72..d41900f 100644
--- a/src/widget.rs
+++ b/src/widget.rs
@@ -1,6 +1,7 @@
use termion::event::{Event, Key, MouseEvent};
use crate::coordinates::{Coordinates, Position, Size};
+use crate::fail::HResult;
use std::io::{BufWriter, Write};
@@ -48,7 +49,7 @@ pub trait Widget {
crate::window::show_status(status);
}
- fn minibuffer(&self, query: &str) -> Option<String> {
+ fn minibuffer(&self, query: &str) -> HResult<String> {
crate::window::minibuffer(query)
}
@@ -115,6 +116,15 @@ pub trait Widget {
.collect()
}
+ fn draw(&self) -> HResult<()> {
+ let drawlist = self.get_drawlist();
+ let mut bufout = BufWriter::new(std::io::stdout());
+
+ write!(bufout, "{}", drawlist)?;
+ bufout.flush()?;
+ Ok(())
+ }
+
fn animate_slide_up(&mut self) {
let coords = self.get_coordinates().clone();
let xpos = coords.position().x();