Canop / broot

A new way to see and navigate directory trees : https://dystroy.org/broot
MIT License
10.76k stars 235 forks source link

`ctrl-h` binding not working? #631

Open ok-nick opened 2 years ago

ok-nick commented 2 years ago

I have a ctrl-h and ctrl-l binding set to move left/right panel, except only the ctrl-l binding works; pressing ctrl-h does nothing, I'm not sure if it's the terminal or the shell, but I can't seem to find any info on it. I'm using Windows 11 w/ Alacritty w/ PowerShell.

Calling :panel_left_no_open directly works fine and so does the ctrl-left binding. No matter what I bind to ctrl-h, nothing seems to work.

Config:

[[verbs]]
key = "ctrl-l"
internal = ":panel_right_no_open"

[[verbs]]
key = "ctrl-h"
internal = ":panel_left_no_open"

Debug log after starting, hitting ctrl-h, then quitting:

21:18:29.503 [INFO] cli_log::init: Starting broot v1.16.2 with log level DEBUG
21:18:29.504 [DEBUG] broot: env::args(): [
    "C:\\Users\\me\\.cargo\\bin\\broot.exe",
    "--outcmd",
    "C:\\Users\\me\\AppData\\Local\\Temp\\tmp68D5.tmp",
]
21:18:29.507 [DEBUG] broot::conf::conf: reading conf file: "C:\\Users\\me\\AppData\\Roaming\\dystroy\\broot\\config\\conf.toml"
21:18:29.507 [DEBUG] broot::cli: Conf::from_default_location() took 2.9587ms
21:18:29.508 [DEBUG] broot::cli: config: Conf {
    files: [
        "C:\\Users\\me\\AppData\\Roaming\\dystroy\\broot\\config\\conf.toml",
    ],
    default_flags: Some(
        "g",
    ),
    date_time_format: None,
    verbs: [
        VerbConf {
            invocation: None,
            internal: Some(
                ":panel_right_no_open",
            ),
            external: None,
            execution: None,
            cmd: None,
            cmd_separator: None,
            key: Some(
                "ctrl-l",
            ),
            keys: [],
            extensions: [],
            shortcut: None,
            leave_broot: None,
            from_shell: None,
            apply_to: None,
            set_working_dir: None,
            working_dir: None,
            description: None,
            auto_exec: None,
            panels: [],
        },
        VerbConf {
            invocation: None,
            internal: Some(
                ":panel_left_no_open",
            ),
            external: None,
            execution: None,
            cmd: None,
            cmd_separator: None,
            key: Some(
                "ctrl-h",
            ),
            keys: [],
            extensions: [],
            shortcut: None,
            leave_broot: None,
            from_shell: None,
            apply_to: None,
            set_working_dir: None,
            working_dir: None,
            description: None,
            auto_exec: None,
            panels: [],
        },
        VerbConf {
            invocation: None,
            internal: Some(
                ":input_del_word_left",
            ),
            external: None,
            execution: None,
            cmd: None,
            cmd_separator: None,
            key: Some(
                "ctrl-w",
            ),
            keys: [],
            extensions: [],
            shortcut: None,
            leave_broot: None,
            from_shell: None,
            apply_to: None,
            set_working_dir: None,
            working_dir: None,
            description: None,
            auto_exec: None,
            panels: [],
        },
        VerbConf {
            invocation: Some(
                "edit",
            ),
            internal: None,
            external: None,
            execution: Some(
                String(
                    "$EDITOR +{line} {file}",
                ),
            ),
            cmd: None,
            cmd_separator: None,
            key: None,
            keys: [],
            extensions: [],
            shortcut: Some(
                "e",
            ),
            leave_broot: Some(
                false,
            ),
            from_shell: None,
            apply_to: None,
            set_working_dir: None,
            working_dir: None,
            description: None,
            auto_exec: None,
            panels: [],
        },
    ],
    skin: None,
    special_paths: {},
    search_modes: None,
    disable_mouse_capture: None,
    capture_mouse: Some(
        false,
    ),
    cols_order: None,
    show_selection_mark: None,
    ext_colors: {},
    syntax_theme: None,
    true_colors: None,
    icon_theme: None,
    modal: None,
    max_panels_count: None,
    quit_on_last_cancel: None,
    file_sum_threads_count: None,
    max_staged_count: None,
    imports: [],
    show_matching_characters_on_path_searches: None,
}
21:18:29.525 [DEBUG] broot::app::app_context: COLORTERM env variable = "truecolor"
21:18:29.525 [DEBUG] broot::app::app_context: true colors are available
21:18:29.526 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 100ns
21:18:29.528 [DEBUG] broot::tree_build::builder: init line_status_computer took 2.0744ms
21:18:29.530 [DEBUG] broot::tree_build::builder: blines before trimming: 47
21:18:29.530 [DEBUG] broot::tree_build::builder: trimming prematurely interrupted
21:18:29.537 [DEBUG] broot::app::app: display panel took 1.2814ms
21:18:29.537 [INFO] broot::app::app: pending_tasks took 500ns
21:18:29.537 [INFO] broot::app::app: event: TimedEvent { time: Instant { t: 239049.4701446s }, event: Resize(99, 30), double_click: false }
21:18:29.537 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 0ns
21:18:29.538 [DEBUG] broot::tree_build::builder: init line_status_computer took 169.2µs
21:18:29.539 [DEBUG] broot::tree_build::builder: blines before trimming: 47
21:18:29.539 [DEBUG] broot::tree_build::builder: trimming prematurely interrupted
21:18:29.545 [DEBUG] broot::app::app: display panel took 751.3µs
21:18:29.545 [INFO] broot::app::app: pending_tasks took 300ns
21:18:31.482 [INFO] broot::app::app: event: TimedEvent { time: Instant { t: 239051.4147281s }, event: Key(KeyEvent { code: Backspace, modifiers: CONTROL }), double_click: false }
21:18:31.482 [DEBUG] broot::app::app: command after add_event: None
21:18:31.482 [DEBUG] broot::app::app: cmd_result: Keep
21:18:31.483 [DEBUG] broot::app::app: display panel took 1.1968ms
21:18:31.484 [INFO] broot::app::app: pending_tasks took 500ns
21:18:32.713 [INFO] broot::app::app: event: TimedEvent { time: Instant { t: 239052.6461632s }, event: Key(KeyEvent { code: Char(':'), modifiers: SHIFT }), double_click: false }
21:18:32.714 [DEBUG] broot::app::app: command after add_event: VerbEdit(VerbInvocation { name: "", args: None, bang: false })
21:18:32.714 [DEBUG] broot::app::app: cmd_result: Keep
21:18:32.715 [DEBUG] broot::app::app: display panel took 1.1358ms
21:18:32.716 [INFO] broot::app::app: pending_tasks took 500ns
21:18:32.825 [INFO] broot::app::app: event: TimedEvent { time: Instant { t: 239052.7576877s }, event: Key(KeyEvent { code: Char('q'), modifiers: NONE }), double_click: false }
21:18:32.825 [DEBUG] broot::app::app: command after add_event: VerbEdit(VerbInvocation { name: "q", args: None, bang: false })
21:18:32.825 [DEBUG] broot::app::app: cmd_result: Keep
21:18:32.826 [DEBUG] broot::app::app: display panel took 1.1298ms
21:18:32.827 [INFO] broot::app::app: pending_tasks took 300ns
21:18:32.937 [INFO] broot::app::app: event: TimedEvent { time: Instant { t: 239052.8697645s }, event: Key(KeyEvent { code: Enter, modifiers: NONE }), double_click: false }
21:18:32.937 [DEBUG] broot::app::app: command after add_event: VerbInvocate(VerbInvocation { name: "q", args: None, bang: false })
21:18:32.937 [DEBUG] broot::app::app: cmd_result: Quit
21:18:32.937 [DEBUG] broot::task_sync: dead dam
21:18:32.938 [INFO] broot: bye
Canop commented 2 years ago

Ctrl-h is not received by broot in your log. It means the combination is intercepted in either your terminal (look at its settings), a multiplexer or similar if you have one, or the OS.

ok-nick commented 2 years ago

I can confirm this is an issue with alacritty. I'll close this issue for now and keep it updated if I find a solution.

Canop commented 2 years ago

@ok-nick Please come back with details as soon as possible, as it might help others

ok-nick commented 2 years ago

Maybe it is an issue with broot?

https://github.com/alacritty/alacritty/issues/6473

kchibisov commented 2 years ago

Maybe something in between intercepts, since we send crtl+h and according to https://github.com/alacritty/alacritty/issues/6473#issuecomment-1306592760 they clearly have ctrl + h working in bash.

@Canop be aware that ctrl + h is usually a backspace. Though in alacritty backspace is ^?. Maybe your terminfo parsing and understanding is wrong when it comes to TERM=alacritty

@ok-nick have you pressed Backspace during testing, since there's clearly a

21:18:31.482 [INFO] broot::app::app: event: TimedEvent { time: Instant { t: 239051.4147281s }, event: Key(KeyEvent { code: Backspace, modifiers: CONTROL }), double_click: false }

From your log, which I think is ctrl+h.

kchibisov commented 2 years ago

@ok-nick maybe if you run broot with TERM variable you have in other terminals it will work by itself. TERM=xterm-256color or whatever you have in other windows terminals by default.

ok-nick commented 2 years ago

I tested again and it's seems to be registering ctrl+h as ctrl+backspace. I tried setting the TERM env variable, as you suggested, but nothing changed.

Setting my keybind to ctrl+backspace fixes the issue, although it's just a workaround.

kchibisov commented 2 years ago

It's actually not, since some terminals do have ctrl+h as backspace. You might be surprised by that, but it's how it is.

@Canop Is broot using extended keyboard protocol so it can actually encode stuff like that? If so that could explain it, since alacritty not supporting it.

stepanzak commented 1 year ago

Hi, I have the same issue but with Alt+h on Arch Linux (EndeavourOS) with KDE Plasma 5.27. I tried it with KDE Konsole and Gnome Terminal.

stepanzak commented 1 year ago

UPDATE: I fixed it by unsetting the Alt+` shortcut in settings. I don't know why Alt+h collides with Alt+` , but it does. In KDE Plasma, Alt+` is assigned to Walk Through Windows of Current Application. I hope this helps!