Skip to content

Commit

Permalink
Revert attempt to use tui-react's drawing…
Browse files Browse the repository at this point in the history
…as it is consistently slower. Don't know what to do there.
Fair enough.
  • Loading branch information
Byron committed Mar 29, 2020
1 parent dff2c86 commit fc0b814
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tui-react/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tui-react"
version = "0.2.3"
version = "0.2.2"
authors = ["Sebastian Thiel <sthiel@thoughtworks.com>"]
edition = "2018"
repository = "https://github.com/Byron/dua-cli"
Expand Down
37 changes: 0 additions & 37 deletions tui-react/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fc0b814

Please sign in to comment.