Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Helix panics on goto_window_center when lines fill less than half the screen #5965

Closed
iobtl opened this issue Feb 13, 2023 · 3 comments · Fixed by #5987
Closed

Helix panics on goto_window_center when lines fill less than half the screen #5965

iobtl opened this issue Feb 13, 2023 · 3 comments · Fixed by #5987
Assignees
Labels
C-bug Category: This is a bug

Comments

@iobtl
Copy link
Contributor

iobtl commented Feb 13, 2023

Summary

Helix panics when trying to go to center of window (when less than half the screen populated)

helixcrash3.mov

Reproduction Steps

I tried this:

  1. RUST_BACKTRACE=1 hx
  2. Navigate to some file (https://github.com/helix-editor/helix/blob/master/helix-term/src/ui/picker.rs in this example)
  3. ge
  4. zt
  5. gc

I expected this to happen:

Probably something similar to align_view_center

Instead, this happened:

hx panics and crashes.

Helix log

~/.cache/helix/helix.log

helix.log only has a bunch of LSP messages, but here is the backtrace, which seems to be clear enough where the problem is:

thread 'main' panicked at 'assertion failed: min <= max', /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/cmp.rs:846:9
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: helix_term::commands::goto_window
   4: helix_term::ui::editor::EditorView::handle_keymap_event::{{closure}}
   5: helix_term::ui::editor::EditorView::handle_keymap_event
   6: <helix_term::ui::editor::EditorView as helix_term::compositor::Component>::handle_event
   7: helix_term::compositor::Compositor::handle_event
   8: helix_term::application::Application::event_loop_until_idle::{{closure}}
   9: helix_term::application::Application::run::{{closure}}
  10: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  11: hx::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Platform

macOS

Terminal Emulator

alacritty 0.10.1 (2844606)

Helix Version

22.12-262-g2bebc504

@iobtl iobtl added the C-bug Category: This is a bug label Feb 13, 2023
@iobtl
Copy link
Contributor Author

iobtl commented Feb 13, 2023

I encountered this bug when remapping C-d = ["half_page_down", "goto_window_center"] and doing ge, C-d, C-d, which crashes the program (with an identical error message as the one in the video).

(Will be happy to take on this bug if it's deemed to be of significant concern, unless the fix is trivially obvious to one of the maintainers)

@pascalkuthe
Copy link
Member

can reproduce, I will look into this since I work on this code last, thanks for reporting 👍

@pascalkuthe pascalkuthe self-assigned this Feb 13, 2023
@iobtl
Copy link
Contributor Author

iobtl commented Feb 13, 2023

Sounds good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants