Skip to content
This repository has been archived by the owner on Aug 6, 2023. It is now read-only.

Paragraph with .wrap(false) can panic when fed long lines #77

Closed
karolinepauls opened this issue Sep 29, 2018 · 0 comments
Closed

Paragraph with .wrap(false) can panic when fed long lines #77

karolinepauls opened this issue Sep 29, 2018 · 0 comments

Comments

@karolinepauls
Copy link
Contributor

karolinepauls commented Sep 29, 2018

Minimal repro with 0.3.0-beta.3 (not a new one - I initially observed it with 0.2.3) and with termion 1.5.1: https://gitlab.com/karolinepauls/tui-repro/blob/master/src/main.rs

First the line gets drawn over the border, then when it reaches the screen boundary, it panics. I would expect .wrap(false) to truncate the excess rather than print it.

Panic (cleaned up, the lines end up printed garbled over the TUI, with broken newlines due to the raw terminal mode):

thread 'main' panicked at 'Trying to access position outside the buffer: x=239, y=3, area=Rect { x: 0, y: 0, width: 239, height: 70 }', /home/k/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.3.0-beta.3/src/buffer.rs:182:9
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::print at libstd/sys_common/backtrace.rs:71 at libstd/sys_common/backtrace.rs:59
2: std::panicking::default_hook::{{closure}} at libstd/panicking.rs:211
3: std::panicking::default_hook at libstd/panicking.rs:227
4: std::panicking::rust_panic_with_hook at libstd/panicking.rs:475
5: std::panicking::continue_panic_fmt at libstd/panicking.rs:390
6: std::panicking::begin_panic_fmt at libstd/panicking.rs:345
7: tui::buffer::Buffer::index_of at /home/k/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.3.0-beta.3/src/buffer.rs:182
8: tui::buffer::Buffer::get_mut at /home/k/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.3.0-beta.3/src/buffer.rs:149
9: <tui::widgets::paragraph::Paragraph<'a, 't, T> as tui::widgets::Widget>::draw
at /home/k/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.3.0-beta.3/src/widgets/paragraph.rs:197
10: <tui::terminal::Frame<'a, B>>::render at /home/k/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.3.0-beta.3/src/terminal.rs:40
11: tui::widgets::Widget::render at /home/k/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.3.0-beta.3/src/widgets/mod.rs: 82
12: tui_repro::main::{{closure}} at src/main.rs:31
13: <tui::terminal::Terminal<B>>::draw at /home/k/.cargo/registry/src/github.com-1ecc6299db9ec823/tui-0.3.0-beta.3/src/terminal.rs:126
14: tui_repro::main at src/main.rs:25
15: std::rt::lang_start::{{closure}} at /checkout/src/libstd/rt.rs:74
16: std::panicking::try::do_call at libstd/rt.rs:59 at libstd/panicking.rs:310
17: __rust_maybe_catch_panic at libpanic_unwind/lib.rs:105
18: std::rt::lang_start_internal at libstd/panicking.rs:289 at libstd/panic.rs:392 at libstd/rt.rs:58
19: std::rt::lang_start at /checkout/src/libstd/rt.rs:74
20: main
21: __libc_start_main
22: _start
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant