aboutsummaryrefslogtreecommitdiff
path: root/helix-tui/src/widgets/table.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-05-22 08:33:42 +0000
committerBlaž Hrastnik2021-05-22 08:33:42 +0000
commitb114cfa119bc94396f1ed38109a51183035574ed (patch)
tree33e30a93e984e41ae0f507478ce93754261a331a /helix-tui/src/widgets/table.rs
parentf1dc25a7741ebec630a09eaf7c7c3c91947f5078 (diff)
Display more data in completion popups.
Diffstat (limited to 'helix-tui/src/widgets/table.rs')
-rw-r--r--helix-tui/src/widgets/table.rs15
1 files changed, 8 insertions, 7 deletions
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<usize>,
+ pub offset: usize,
+ pub selected: Option<usize>,
}
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);
}
}