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

Mapping ctrl-j executes Enter #177

Closed
madhermit opened this issue Jan 22, 2020 · 4 comments
Closed

Mapping ctrl-j executes Enter #177

madhermit opened this issue Jan 22, 2020 · 4 comments

Comments

@madhermit
Copy link

Describe the bug
After mapping ctrl-j in the config file, using it in broot acts like hitting the Enter key

To Reproduce
Steps to reproduce the behavior:
1.) Add the following to the config.toml file

[[verbs]]
name = "line_down"
key = "ctrl-j"
execution = ":line_down"

2.) Open broot by typing $ broot
3.) Hit ctrl-j

Expected behavior
The cursor should move down an entry, just as if you were hitting the down arrow key

Screenshots
Result of $ BROOT_LOG=debug broot

19:44:42 [DEBUG] (1) broot::shell_install: Shell script already installed. Doing nothing.
19:44:42 [DEBUG] (1) broot::app: we're on screen
19:44:42 [DEBUG] (1) broot::git_ignore: searching applicable gifs for "/home/madhermit/broot_log"
19:44:42 [DEBUG] (1) broot::git_ignore:   looking in "/home/madhermit/broot_log"
19:44:42 [DEBUG] (1) broot::git_ignore:   looking in "/home/madhermit"
19:44:42 [DEBUG] (1) broot::git_ignore:   looking in "/home"
19:44:42 [DEBUG] (1) broot::git_ignore:   looking in "/"
19:44:42 [DEBUG] (1) broot::tree_build::builder: start building - total=false pattern=None
19:44:42 [DEBUG] (1) broot::tree_build::builder: Trimming: we have 2 lines for a goal of 77
19:44:44 [DEBUG] (1) broot::commands: add_event Key(KeyEvent { code: Enter, modifiers: (empty) })
19:44:44 [DEBUG] (1) broot::app: command after add_event: Command { raw: "", parts: CommandParts { pattern: None, regex_flags: None, verb_invocation: None }, action: OpenSelection }
19:44:44 [DEBUG] (1) broot::app: action: OpenSelection
19:44:44 [DEBUG] (1) broot::git_ignore: searching applicable gifs for "/home/madhermit"
19:44:44 [DEBUG] (1) broot::git_ignore:   looking in "/home/madhermit"
19:44:44 [DEBUG] (1) broot::git_ignore:   looking in "/home"
19:44:44 [DEBUG] (1) broot::git_ignore:   looking in "/"
19:44:44 [DEBUG] (1) broot::tree_build::builder: start building - total=false pattern=None
19:44:44 [DEBUG] (1) broot::tree_build::builder: Trimming: we have 78 lines for a goal of 77
19:44:44 [DEBUG] (1) broot::flat_tree: turning "/home/madhermit/<redacted>" into Pruning
19:44:44 [DEBUG] (1) broot::flat_tree: turning "/home/madhermit/<redcated>" into Pruning
19:44:45 [DEBUG] (1) broot::commands: add_event Key(KeyEvent { code: Char('c'), modifiers: CONTROL })
19:44:45 [DEBUG] (1) broot::app: command after add_event: Command { raw: "", parts: CommandParts { pattern: None, regex_flags: None, verb_invocation: None }, action: VerbIndex(1) }
19:44:45 [DEBUG] (1) broot::app: action: VerbIndex(1)
19:44:45 [DEBUG] (1) broot::app: cmd result quit
19:44:45 [DEBUG] (1) broot::app: we left the screen
19:44:45 [ INFO] bye

Configuration (please complete the following information):

  • OS: Ubuntu 16.04.6 LTS
  • Broot Version: broot 0.12.0
  • Terminal Emulator: alacritty 0.4.1
  • Window Manager: i3 version 4.17.1 (2019-08-30)

Additional context
Setting up an alternative mapping such as ctrl-n with execution = ":line_down" works as expected

@Canop
Copy link
Owner

Canop commented Jan 22, 2020

The culprit, and the reason I contact the crossterm team, is this log:

19:44:44 [DEBUG] (1) broot::commands: add_event Key(KeyEvent { code: Enter, modifiers: (empty) })

and I've had 2 other similar reports.

Additional note: @madhermit said vim correctly receives ctrl-j events.

@TimonPost
Copy link

TimonPost commented Jan 27, 2020

This PR fixes the issue for me. You might want to give it a try as well crossterm-rs/crossterm#373

@Canop
Copy link
Owner

Canop commented Jan 27, 2020

Thanks @TimonPost !

@Canop Canop closed this as completed in c84653e Jan 29, 2020
@madhermit
Copy link
Author

Awesome work! Thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants