From 7fc77f8605bf637331f2f9c283c4b4e284891af1 Mon Sep 17 00:00:00 2001 From: rabite Date: Mon, 25 Feb 2019 18:23:48 +0100 Subject: minibuffer Widgetified --- src/widget.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/widget.rs') 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 { + fn minibuffer(&self, query: &str) -> HResult { 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(); -- cgit v1.2.3