Skip to content

Commit

Permalink
Revert "use tui-react to draw text…"
Browse files Browse the repository at this point in the history
This reverts commit e8c00b7
  • Loading branch information
Byron committed Mar 29, 2020
1 parent 12fd993 commit dff2c86
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions tui-react/src/list.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use crate::draw_text_without_ellipsis_nowrap;
use crate::util::rect::offset_x;
use tui::{
buffer::Buffer,
layout::Rect,
style::Style,
widgets::{Block, Text, Widget},
widgets::{Block, Paragraph, Text, Widget},
};

#[derive(Default)]
Expand Down Expand Up @@ -65,20 +62,15 @@ impl List {
.take(list_area.height as usize)
{
let (x, y) = (list_area.left(), list_area.top() + i as u16);
let mut bound = Rect {
x,
y,
width: list_area.width,
height: 1,
};
for text in text_iterator.into_iter() {
let (text, style) = match text {
Text::Raw(s) => (s, Style::default()),
Text::Styled(s, style) => (s, style),
};
let offset = draw_text_without_ellipsis_nowrap(bound, buf, text, Some(style));
bound = offset_x(bound, offset);
}
Paragraph::new(text_iterator.iter()).draw(
Rect {
x,
y,
width: list_area.width,
height: 1,
},
buf,
);
}
}
}

0 comments on commit dff2c86

Please sign in to comment.