Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Panics on smaller terminal sizes #74

Closed
IceDragon200 opened this issue Jun 3, 2021 · 2 comments
Closed

Panics on smaller terminal sizes #74

IceDragon200 opened this issue Jun 3, 2021 · 2 comments
Labels
C-bug Category: This is a bug

Comments

@IceDragon200
Copy link
Contributor

Helix still panics when the overall terminal size is too small, I haven't pinned down the exact width to trigger it to panic, but I'm sure someone will figure it out soon enough.

@IceDragon200 IceDragon200 added the C-bug Category: This is a bug label Jun 3, 2021
@rikusalminen
Copy link

rikusalminen commented Jun 3, 2021

I'm not sure what @IceDragon200 did to trigger the panic, but here's a backtrace I got from a similar issue...

To reproduce:

  1. make terminal window really small (like 10x10)
  2. enter command prompt by typing: :

Root cause: division by zero in prompt.rs line 118.

let max_col = area.width / BASE_WIDTH;
let height = ((self.completion.len() as u16 + max_col - 1) / max_col);

In the above area.width = 16 and BASE_WIDTH is hard coded to 30, causing max_col to be zero.

Looks like the command prompt doesn't handle terminal window size correctly, issue #54 was a very similar bug related to BASE_WIDTH and terminal size.

#1 0x0000555556353f54 in std::panicking::rust_panic_with_hook ()
at library/std/src/panicking.rs:610
#2 0x0000555556353a67 in std::panicking::begin_panic_handler::{{closure}} ()
at library/std/src/panicking.rs:495
#3 0x0000555556351a3c in std::sys_common::backtrace::__rust_end_short_backtrace<closure-0,!> () at library/std/src/sys_common/backtrace.rs:141
#4 0x00005555563539f9 in std::panicking::begin_panic_handler ()
at library/std/src/panicking.rs:493
#5 0x00005555556dbdd1 in core::panicking::panic_fmt ()
at library/core/src/panicking.rs:92
#6 0x00005555556dbd1d in core::panicking::panic () at library/core/src/panicking.rs:50
#7 0x0000555555896ed5 in hx::ui::prompt::Prompt::render_prompt (self=0x555557626b50,
area=..., surface=0x7fffffffbec0, cx=0x7fffffff9c88)
at helix-term/src/ui/prompt.rs:118
#8 0x0000555555897706 in hx::ui::prompt::{{impl}}::render (self=0x555557626b50,
area=..., surface=0x7fffffffbec0, cx=0x7fffffff9c88)
at helix-term/src/ui/prompt.rs:273
#9 0x00005555557386de in hx::compositor::Compositor::render (self=0x7fffffffbea0,
cx=0x7fffffff9c88) at helix-term/src/compositor.rs:137
#10 0x00005555557d58ec in hx::application::Application::render (self=0x7fffffffbea0)
at helix-term/src/application.rs:79
#11 0x00005555557d704d in hx::application::Application::handle_terminal_events (
self=0x7fffffffbea0, event=...) at helix-term/src/application.rs:138
#12 0x00005555557d6679 in hx::application::{{impl}}::event_loop::{{closure}} ()
at helix-term/src/application.rs:96
#13 0x000055555571e76b in core::future::from_generator::{{impl}}::poll (
self=..., cx=0x7fffffffbe18)
at /home/rsalminen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80
#14 0x00005555557d904f in hx::application::{{impl}}::run::{{closure}} ()
at helix-term/src/application.rs:254
#15 0x000055555571e159 in core::future::from_generator::{{impl}}::poll (
self=..., cx=0x7fffffffbe18)
at /home/rsalminen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80
#16 0x00005555557dbee7 in hx::main::{{closure}} () at helix-term/src/main.rs:169
#17 0x000055555571d7f9 in core::future::from_generator::{{impl}}::poll (
self=..., cx=0x7fffffffbe18)
at /home/rsalminen/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80
#18 0x00005555558b4060 in tokio::park::thread::{{impl}}::block_on::{{closure}}<core::future::from_generator::GenFuture> ()
at /home/rsalminen/.cargo/registry/src/github.heygears.com-1ecc6299db9ec823/tokio-1.6.1/src/park/thread.rs:263

kirawi added a commit to kirawi/helix that referenced this issue Jun 3, 2021
This was referenced Jun 3, 2021
@archseer
Copy link
Member

archseer commented Jun 5, 2021

Fixed by #121

@archseer archseer closed this as completed Jun 5, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

3 participants