Closed cjbassi closed 4 years ago
I'll take a look, great work :)
@cjbassi I got it to build
After a while, it panicks.
Backtrace (most recent call first):
File "/home/richie/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.9.1/src/widgets/canvas/line.rs", line 82, in tui::widgets::canvas::line::draw_line_high
x = if x1 > x2 { x - 1 } else { x + 1 };
File "/home/richie/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.9.1/src/widgets/canvas/line.rs", line 52, in <tui::widgets::canvas::line::Line as tui::widgets::canvas::Shape>::draw
draw_line_high(painter, x2, y2, x1, y1, self.color);
File "/home/richie/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.9.1/src/widgets/canvas/mod.rs", line 279, in tui::widgets::canvas::Context::draw
shape.draw(&mut painter);
File "/home/richie/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.9.1/src/widgets/chart.rs", line 503, in <tui::widgets::chart::Chart<LX,LY> as tui::widgets::Widget>::render::{{closure}}
ctx.draw(&Line {
File "/home/richie/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.9.1/src/widgets/canvas/mod.rs", line 443, in <tui::widgets::canvas::Canvas<F> as tui::widgets::Widget>::render
painter(&mut ctx);
File "/home/richie/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.9.1/src/widgets/chart.rs", line 491, in <tui::widgets::chart::Chart<LX,LY> as tui::widgets::Widget>::render
Canvas::default()
File "src/widgets/cpu.rs", line 147, in <&ytop::widgets::cpu::CpuWidget as tui::widgets::Widget>::render
Chart::<String, String>::default()
File "/home/richie/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.9.1/src/terminal.rs", line 65, in tui::terminal::Frame<B>::render_widget
widget.render(area, self.terminal.current_buffer_mut());
File "src/draw.rs", line 65, in ytop::draw::draw_top_row
frame.render_widget(&widgets.cpu, horizontal_chunks[0]);
File "src/draw.rs", line 39, in ytop::draw::draw_widgets
draw_top_row(frame, widgets, vertical_chunks[0]);
File "src/draw.rs", line 20, in ytop::draw::draw::{{closure}}
draw_widgets(&mut frame, &mut app.widgets, chunks[0]);
File "/home/richie/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.9.1/src/terminal.rs", line 187, in tui::terminal::Terminal<B>::draw
f(self.get_frame());
File "src/draw.rs", line 8, in ytop::draw::draw
terminal
File "src/main.rs", line 177, in ytop::main
draw(&mut terminal, &mut app);
The application panicked (crashed).
attempt to subtract with overflow
in /home/richie/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.9.1/src/widgets/canvas/line.rs, line 82
thread: main
I think the panic was just fixed in the latest release of tui, so we can go ahead with this. Thanks for the work you did here to get this to work!
Not yet, but I'll try to help as I can.
That looks like it might be different bug. Could you run it again with RUST_BACKTRACE=full to get the stack trace?
Sure:
% RUST_BACKTRACE=full ytop ~
Backtrace (most recent call first):
File "<unknown>", line 0, in core::panicking::panic_bounds_check
File "<unknown>", line 0, in <tui::widgets::block::Block as tui::widgets::Widget>::render
File "<unknown>", line 0, in <tui::widgets::paragraph::Paragraph<T> as tui::widgets::Widget>::render
File "<unknown>", line 0, in tui::terminal::Terminal<B>::draw
File "<unknown>", line 0, in ytop::main
File "<unknown>", line 0, in std::rt::lang_start::{{closure}}
File "<unknown>", line 0, in std::panicking::try::do_call
File "<unknown>", line 0, in __rust_maybe_catch_panic
File "<unknown>", line 0, in std::rt::lang_start_internal
File "<unknown>", line 0, in main
The application panicked (crashed).
index out of bounds: the len is 2000 but the index is 65392
in rust:src/libcore/slice/mod.rs, line 2848
thread: main
Alright, should be fixed now on master. I'll have to create a new release for it soon.
Yeap, now it's confirmed. Thanks @cjbassi
We need to upgrade tui for a few features and bug fixes but there is quite a few api changes in the latest release. I've started some work on this in the upgrade-tui branch, but i've just been a little busy with some other things if anybody feels like continuing to work on it. If you make any progress feel free to open a pull request against that branch. Thanks!