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

Changing modes through a keybind that executes multiple commands crashes Helix #2587

Closed
lucypero opened this issue May 27, 2022 · 1 comment
Labels
C-bug Category: This is a bug R-duplicate Duplicated issue: please refer to the linked issue

Comments

@lucypero
Copy link
Contributor

Summary

this mapping crashes Helix:

[keys.normal]
C = ["extend_to_line_end", "change_selection"]

I believe the crash happens when you transition editing modes through a keymap that executes multiple commands.

Output:

thread 'main' panicked at 'not implemented', helix-term\src\ui\editor.rs:1292:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It crashes here in helix-term/src/ui/editor.rs:

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!(),
                        };

Adding this line prevents the crash:

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

Reproduction Steps

No response

Helix log

~/.cache/helix/helix.log
please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines

Platform

Windows

Terminal Emulator

Windows Terminal

Helix Version

22.03-258-gefae7616

@lucypero lucypero added the C-bug Category: This is a bug label May 27, 2022
@the-mikedavis
Copy link
Member

Duplicate of #2051

@the-mikedavis the-mikedavis marked this as a duplicate of #2051 May 28, 2022
@the-mikedavis the-mikedavis added the R-duplicate Duplicated issue: please refer to the linked issue label May 28, 2022
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