From b114cfa119bc94396f1ed38109a51183035574ed Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Sat, 22 May 2021 17:33:42 +0900 Subject: Display more data in completion popups. --- helix-tui/src/widgets/mod.rs | 4 ++-- helix-tui/src/widgets/table.rs | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'helix-tui') diff --git a/helix-tui/src/widgets/mod.rs b/helix-tui/src/widgets/mod.rs index 00744a1c..e334b894 100644 --- a/helix-tui/src/widgets/mod.rs +++ b/helix-tui/src/widgets/mod.rs @@ -13,12 +13,12 @@ mod block; // mod list; mod paragraph; mod reflow; -// mod table; +mod table; pub use self::block::{Block, BorderType}; // pub use self::list::{List, ListItem, ListState}; pub use self::paragraph::{Paragraph, Wrap}; -// pub use self::table::{Cell, Row, Table, TableState}; +pub use self::table::{Cell, Row, Table, TableState}; use crate::{buffer::Buffer, layout::Rect}; use bitflags::bitflags; diff --git a/helix-tui/src/widgets/table.rs b/helix-tui/src/widgets/table.rs index 31624a8f..d42d7d30 100644 --- a/helix-tui/src/widgets/table.rs +++ b/helix-tui/src/widgets/table.rs @@ -3,7 +3,7 @@ use crate::{ layout::{Constraint, Rect}, style::Style, text::Text, - widgets::{Block, StatefulWidget, Widget}, + widgets::{Block, Widget}, }; use cassowary::{ strength::{MEDIUM, REQUIRED, WEAK}, @@ -368,8 +368,8 @@ impl<'a> Table<'a> { #[derive(Debug, Clone)] pub struct TableState { - offset: usize, - selected: Option, + pub offset: usize, + pub selected: Option, } impl Default for TableState { @@ -394,10 +394,11 @@ impl TableState { } } -impl<'a> StatefulWidget for Table<'a> { - type State = TableState; +// impl<'a> StatefulWidget for Table<'a> { +impl<'a> Table<'a> { + // type State = TableState; - fn render(mut self, area: Rect, buf: &mut Buffer, state: &mut Self::State) { + pub fn render_table(mut self, area: Rect, buf: &mut Buffer, state: &mut TableState) { if area.area() == 0 { return; } @@ -522,7 +523,7 @@ fn render_cell(buf: &mut Buffer, cell: &Cell, area: Rect) { impl<'a> Widget for Table<'a> { fn render(self, area: Rect, buf: &mut Buffer) { let mut state = TableState::default(); - StatefulWidget::render(self, area, buf, &mut state); + Table::render_table(self, area, buf, &mut state); } } -- cgit v1.2.3-70-g09d2