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

disable_default_key_bindings does not affect some of the behaviors of Ctrl+C (keybinding appears to be hardcoded) #4666

Closed
crabdancing opened this issue Dec 12, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@crabdancing
Copy link

crabdancing commented Dec 12, 2023

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

kwin 5.27.9

WezTerm version

wezterm 20230712-072601-f4abf8fd

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

No, and I'll explain why below

Describe the bug

(Nightly is prohibitively difficult, as Wezterm does not currently have a supported Nix flake. That said, I'm reasonably confident this behavior is likely to have not changed recently.)

Ctrl+C moves the view down to the bottom of the window. Ordinarily, this is desirable behavior, as most

To Reproduce

  1. Setup config disabling default key bindings
  2. fill the terminal with test text (e.g., for i in 0..1000 { echo $i } if you are using Nushell)
  3. scroll up and hit Ctrl+C

Configuration

local config = {}
config.disable_default_key_bindings = true;
return config

Expected Behavior

Expected Wezterm to not react to Ctrl+C, when default keybindings are disabled. Ctrl+C response should be an explicit keybinding, and not hardcoded or 'invisible'.

Logs

No response

Anything else?

No response

@crabdancing crabdancing added the bug Something isn't working label Dec 12, 2023
@bew
Copy link
Sponsor Contributor

bew commented Dec 12, 2023

This behavior is not specific to Ctrl-c, all keys will scroll to the end.
Try to set scroll_to_bottom_on_input = false, although it won't scroll it will still send those keys but you won't see them
ref: https://wezfurlong.org/wezterm/config/lua/config/scroll_to_bottom_on_input.html

(note: with nu you can also do seq 1 100 to quickly write some output 🙃)

@crabdancing
Copy link
Author

crabdancing commented Dec 12, 2023

@bew

Woah! But Ctrl+Shift+C doesn't do it. I guess it's special behavior of the shift key, then? I should look at the code for input processing.

Also, I didn't know nushell had seq like Bash & Fish do. Thanks for the tip :D

Edit: looks like it works. Now all I'd like to do is get the scrolling behavior back, but for Ctrl+Q specifically. Maybe I can rig it up with some Lua?

@bew
Copy link
Sponsor Contributor

bew commented Dec 12, 2023

Yeah, I think using wezterm.action.ScrollToBottom should do it?
Ref: https://wezfurlong.org/wezterm/config/lua/keyassignment/ScrollToBottom.html

@crabdancing
Copy link
Author

Oh, awesome! Is there a way of binding some code to a keybinding without intercepting the keybinding? When I do { key = 'q', mods = 'CTRL', action = act.ScrollToBottom }, it eats Ctrl+Q and the terminal stack can't respond to the keypress.

@bew
Copy link
Sponsor Contributor

bew commented Dec 13, 2023

Well the simplest solution here would be to use a act.Multiple action, to call act.ScrollToBottom then act.SendKey with the key you want to send.

Check these additional docs:

@crabdancing
Copy link
Author

{ key = 'q', mods = 'CTRL', action = act.Multiple { act.ScrollToBottom, act.SendKey { key = 'q', mods = 'CTRL' } } } worked, thanks! :)

Copy link
Contributor

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants