broot icon indicating copy to clipboard operation
broot copied to clipboard

`ctrl-h` binding not working?

Open ok-nick opened this issue 3 years ago • 10 comments

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

ok-nick avatar Nov 05 '22 01:11 ok-nick

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.

Canop avatar Nov 06 '22 09:11 Canop

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.

ok-nick avatar Nov 06 '22 17:11 ok-nick

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

Canop avatar Nov 06 '22 17:11 Canop

Maybe it is an issue with broot?

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

ok-nick avatar Nov 08 '22 06:11 ok-nick

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 avatar Nov 08 '22 06:11 kchibisov

@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.

kchibisov avatar Nov 08 '22 06:11 kchibisov

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.

ok-nick avatar Nov 08 '22 06:11 ok-nick

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.

kchibisov avatar Nov 08 '22 07:11 kchibisov

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 avatar Feb 18 '23 12:02 stepanzak

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!

stepanzak avatar Feb 18 '23 16:02 stepanzak