You are not logged in.
In many text editors, you can use Ctrl+Backspace to delete a whole word at a time, and Ctrl+Delete to delete the word to the right. For example, this works in Firefox in the text field I am now typing in. It also works for me in Kate.
However, in some programs, such as Alacritty and Qterminal, I am able to use Ctrl+Delete, but unable to use Ctrl+Backspace. Instead, I have to use Alt+Backspace to delete the word to the left. This occurs only on this machine, a Macbook Pro 9,2, whereas on my other machines the usual Ctrl+Backspace works as intended.
To investigate the issue further, I tried configuring this shortcut manually for the micro terminal text editor by adding the following keybindings to ~/.config/micro/bindings.json:
{
"Alt-/": "lua:comment.comment",
"CtrlUnderscore": "lua:comment.comment",
"CtrlLeft": "WordLeft",
"CtrlRight": "WordRight",
"CtrlBackspace": "DeleteWordLeft",
"CtrlDelete": "DeleteWordRight"
}This yields no change in behavior: Ctrl+Delete deletes the word to the right, and Ctrl+Backspace deletes the character to the left.
One feature of micro is that you can type `raw` in the command pane to record your keystrokes. This producing interesting results:
Pressing Backspace yields EventKey: Backspace2: "\u007f"
Pressing Ctrl+Backspace yields EventKey: Backspace: "\b"
Pressing Alt+Backspace yields EventKey: Alt+Backspace2: "\x1b\u007f"
It seems that my normal backspace key is interpreted by micro (or Alacritty, in which I am running micro?) as this thing called Backspace2, and adding the Ctrl modifier revers it to a normal Backspace.
But the output of `xev` for Backspace followed by Ctrl+Backspace looks normal:
KeyPress event, serial 47, synthetic NO, window 0x1e00001,
root 0x3ef, subw 0x0, time 2010101, (794,589), root:(794,613),
state 0x0, keycode 22 (keysym 0xff08, BackSpace), same_screen YES,
XLookupString gives 1 bytes: (08) "
XmbLookupString gives 1 bytes: (08) "
XFilterEvent returns: False
KeyRelease event, serial 47, synthetic NO, window 0x1e00001,
root 0x3ef, subw 0x0, time 2010165, (794,589), root:(794,613),
state 0x0, keycode 22 (keysym 0xff08, BackSpace), same_screen YES,
XLookupString gives 1 bytes: (08) "
XFilterEvent returns: False
KeyPress event, serial 47, synthetic NO, window 0x1e00001,
root 0x3ef, subw 0x0, time 2013789, (794,589), root:(794,613),
state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 47, synthetic NO, window 0x1e00001,
root 0x3ef, subw 0x0, time 2013893, (794,589), root:(794,613),
state 0x4, keycode 22 (keysym 0xff08, BackSpace), same_screen YES,
XLookupString gives 1 bytes: (08) "
XmbLookupString gives 1 bytes: (08) "
XFilterEvent returns: False
KeyRelease event, serial 47, synthetic NO, window 0x1e00001,
root 0x3ef, subw 0x0, time 2013957, (794,589), root:(794,613),
state 0x4, keycode 22 (keysym 0xff08, BackSpace), same_screen YES,
XLookupString gives 1 bytes: (08) "
XFilterEvent returns: False
KeyRelease event, serial 47, synthetic NO, window 0x1e00001,
root 0x3ef, subw 0x0, time 2014053, (794,589), root:(794,613),
state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: FalseWhy do programs like micro and Alacritty handle my backspace key differently from others? What else can I do to try to rectify this behavior?
It may be relevant that I am using ibus (v1.5.26-2) with a Korean keyboard layout.
I am also having another keyboard issue. I think it is unrelated to this one because the set of programs that work/don't work as expected is different, but there is the link just in case.
Offline
This isn't the terminal emulator, but the shell inside.
See eg. https://unix.stackexchange.com/question … te-in-bash
Offline
This isn't the terminal emulator, but the shell inside.
See eg. https://unix.stackexchange.com/question … te-in-bash
I thought this may be the case, but I have the same exact behavior across fish, sh, and bash.
Note that the problem I am having isn't the same as the one defined in that SE post: There, Ctrl+Backspace deleted words, but the poster wanted to change the way it defined word boundaries. In my case, Ctrl+Backspace behaves exactly like normal Backspace, deleting one character at a time.
Offline
Yes, that's the default behavior.
The SE thread starts w/ him redefining the action but not leading to the desired results.
stty werase '^H' in bash has a very good chance of getting you (near) the desired behavior.
It's not gonna work in fish or zsh, though. That's why I pointed out that the actual shell is relevant.
Offline