diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-30 00:51:03 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-30 00:51:03 +0800 |
commit | fc0b814eab5d4157b3c09b34957c8a68e39d46d3 (patch) | |
tree | 23b3991f66259323cdaa6c5562263df97be91980 /tui-react/src/lib.rs | |
parent | dff2c8637198f1b695d3ccf25a49566e55e38249 (diff) |
Revert attempt to use tui-react's drawing…
…as it is consistently slower. Don't know what to do there.
Fair enough.
Diffstat (limited to 'tui-react/src/lib.rs')
-rw-r--r-- | tui-react/src/lib.rs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/tui-react/src/lib.rs b/tui-react/src/lib.rs index e0537a4..de9fad1 100644 --- a/tui-react/src/lib.rs +++ b/tui-react/src/lib.rs @@ -74,43 +74,6 @@ pub fn draw_text_with_ellipsis_nowrap<'a>( total_width as u16 } -pub fn draw_text_without_ellipsis_nowrap<'a>( - bound: Rect, - buf: &mut Buffer, - text: impl AsRef<str>, - style: impl Into<Option<Style>>, -) -> u16 { - let s = style.into(); - let t = text.as_ref(); - let graphemes = t.graphemes(true); - let mut total_width = 0; - { - let mut x_offset = 0; - for (g, mut x) in graphemes.zip(bound.left()..bound.right()) { - let width = g.width(); - total_width += width; - - x += x_offset; - let cell = buf.get_mut(x, bound.y); - cell.symbol = g.into(); - if let Some(s) = s { - cell.style = s; - } - - x_offset += width.saturating_sub(1) as u16; - if x + x_offset >= bound.right() { - break; - } - let x = x as usize; - for x in x + 1..x + width { - let i = buf.index_of(x as u16, bound.y); - buf.content[i].reset(); - } - } - } - total_width as u16 -} - pub fn draw_text_nowrap_fn( bound: Rect, buf: &mut Buffer, |