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

Not Implemented Panic on [ "extend_line", "delete_selection", "open_above" ] depending on keybind #3529

Closed
diktomat opened this issue Aug 24, 2022 · 3 comments
Labels
C-bug Category: This is a bug R-duplicate Duplicated issue: please refer to the linked issue

Comments

@diktomat
Copy link
Contributor

diktomat commented Aug 24, 2022

Summary

In my ongoing quest to battle Helix's behavior with newlines, I added x = { c = [ "extend_line", "delete_selection", "open_above" ] } to my config.toml. While working as intended, I had to realize this breaks every other use of x, so I changed the binding to use S instead. Having changed nothing but the key, it panics with not implemented.

Reproduction Steps

I tried this:

  1. Set the keybind in config.toml: S = [ "extend_line", "delete_selection", "open_above" ]
  2. Use it.

I expected this to happen:
It works, as it does when set to xc.

Instead, this happened:

❯ RUST_BACKTRACE=1 hx src/lib.rs 
thread 'main' panicked at 'not implemented', helix-term/src/ui/editor.rs:1230:34
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: <helix_term::ui::editor::EditorView as helix_term::compositor::Component>::handle_event
   4: helix_term::compositor::Compositor::handle_event
   5: helix_term::application::Application::handle_terminal_events
   6: helix_term::application::Application::event_loop_until_idle::{{closure}}
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   8: std::thread::local::LocalKey<T>::with
   9: tokio::park::thread::CachedParkThread::block_on
  10: tokio::runtime::thread_pool::ThreadPool::block_on
  11: tokio::runtime::Runtime::block_on
  12: hx::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Helix log

No response

Platform

macOS 12.5.1

Terminal Emulator

Kitty 0.25.2

Helix Version

22.05-418-g18909aa

@diktomat diktomat added the C-bug Category: This is a bug label Aug 24, 2022
@the-mikedavis
Copy link
Member

Duplicate of #2051

@the-mikedavis the-mikedavis marked this as a duplicate of #2051 Aug 24, 2022
@the-mikedavis the-mikedavis closed this as not planned Won't fix, can't repro, duplicate, stale Aug 24, 2022
@the-mikedavis the-mikedavis added the R-duplicate Duplicated issue: please refer to the linked issue label Aug 24, 2022
@diktomat
Copy link
Contributor Author

I actually don't believe this to be a duplicate (I've seen #2051 before submitting the issue), as it works when set to xc, but please just keep it closed if I'm wrong:

S = [ "extend_line", "delete_selection", "open_above" ]           # panic
x = { c = [ "extend_line", "delete_selection", "open_above" ] }   # fine

@the-mikedavis
Copy link
Member

The panic for S comes from the unimplemented! in #2051:

self.last_insert.0 = match self.keymaps.get(mode, key) {
KeymapResult::Matched(command) => command,
// FIXME: insert mode can only be entered through single KeyCodes
_ => unimplemented!(),
};

That block assumes that you are only entering insert mode by a single key bound to a single command. xc should panic from that same unimplemented! but currently the lookup of xc in self.keymaps.get(mode, key) mistakenly only looks up the c key event which gives KeymapResult::Matched(MappableCommand("change_selection")) - the binding for c. It looks like both problems are solved by #2634

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 R-duplicate Duplicated issue: please refer to the linked issue
Projects
None yet
Development

No branches or pull requests

2 participants