diff options
Diffstat (limited to 'helix-tui/src/widgets')
-rw-r--r-- | helix-tui/src/widgets/clear.rs | 36 | ||||
-rw-r--r-- | helix-tui/src/widgets/mod.rs | 3 |
2 files changed, 0 insertions, 39 deletions
diff --git a/helix-tui/src/widgets/clear.rs b/helix-tui/src/widgets/clear.rs deleted file mode 100644 index d1da40de..00000000 --- a/helix-tui/src/widgets/clear.rs +++ /dev/null @@ -1,36 +0,0 @@ -use crate::buffer::Buffer; -use crate::layout::Rect; -use crate::widgets::Widget; - -/// A widget to to clear/reset a certain area to allow overdrawing (e.g. for popups) -/// -/// # Examples -/// -/// ``` -/// # use helix_tui::widgets::{Clear, Block, Borders}; -/// # use helix_tui::layout::Rect; -/// # use helix_tui::Frame; -/// # use helix_tui::backend::Backend; -/// fn draw_on_clear<B: Backend>(f: &mut Frame<B>, area: Rect) { -/// let block = Block::default().title("Block").borders(Borders::ALL); -/// f.render_widget(Clear, area); // <- this will clear/reset the area first -/// f.render_widget(block, area); // now render the block widget -/// } -/// ``` -/// -/// # Popup Example -/// -/// For a more complete example how to utilize `Clear` to realize popups see -/// the example `examples/popup.rs` -#[derive(Debug, Clone)] -pub struct Clear; - -impl Widget for Clear { - fn render(self, area: Rect, buf: &mut Buffer) { - for x in area.left()..area.right() { - for y in area.top()..area.bottom() { - buf.get_mut(x, y).reset(); - } - } - } -} diff --git a/helix-tui/src/widgets/mod.rs b/helix-tui/src/widgets/mod.rs index 76eb73c1..5a48e9b5 100644 --- a/helix-tui/src/widgets/mod.rs +++ b/helix-tui/src/widgets/mod.rs @@ -9,17 +9,14 @@ //! - [`List`] //! - [`Table`] //! - [`Paragraph`] -//! - [`Clear`] mod block; -mod clear; // mod list; mod paragraph; mod reflow; // mod table; pub use self::block::{Block, BorderType}; -pub use self::clear::Clear; // pub use self::list::{List, ListItem, ListState}; pub use self::paragraph::{Paragraph, Wrap}; // pub use self::table::{Cell, Row, Table, TableState}; |