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

Differenciate between Backspace and Ctrl+Backspace #1

Closed
jleclanche opened this issue Apr 4, 2012 · 5 comments
Closed

Differenciate between Backspace and Ctrl+Backspace #1

jleclanche opened this issue Apr 4, 2012 · 5 comments

Comments

@jleclanche
Copy link
Member

Ctrl+Backspace on linux/macbook/Default sends the same signal as backspace, ^?. On vt420pc/solaris they're both ^H.

^H should be sent by "backspace" and ^? by "ctrl+backspace"; a Ctrl+V in xterm shows the proper behaviour.

@pvanek
Copy link
Contributor

pvanek commented Jul 17, 2012

can you examine the keytab files and provide some example with real values, please? I'm a little bit lost here. BTW these files (except macbook) are taken from konsole.

@jleclanche
Copy link
Member Author

Not sure what you mean, I filed this bug after a chat with the #zsh guys. I do believe Konsole has the same issue. The issue is when binding the keys, cf:

# Bind delete key to delete next char
bindkey -M emacs "$terminfo[kdch1]" delete-char

# Bind ctrl-left / ctrl-right
bindkey "\e[1;5D" backward-word
bindkey "\e[1;5C" forward-word

# Bind ctrl-backspace to delete word. NOTE: This may not work properly in some emulators
# bindkey "^?" backward-delete-word

@alert-debug
Copy link

For the record, I managed to enable support in Konsole for Ctrl-Left/Right to skip words and Ctrl-Backspace to delete words, by making two changes:

In the config for Konsole itself -

  • Add a new "Key Bindings" entry under the "Keyboard" tab of "Edit Current Profile..." by creating a copy of ~/.kde/share/apps/konsole/default.keytab in the same directory.
  • In the new keytab file, remove the entry for key Backspace : "\x7f"
  • In its place, add a new entry key Backspace+Ctrl : "\E[9;3~"
  • Update the name of this key binding on the keyboard line.

In the file ~/.inputrc -

  • Add the following lines:
    "\e[9;3~": backward-kill-word

    "\e[1;5C": forward-word
    "\e[1;5D": backward-word
    "\e[5C": forward-word
    "\e[5D": backward-word
    "\e\e[C": forward-word
    "\e\e[D": backward-word

@pvanek
Copy link
Contributor

pvanek commented Sep 8, 2014

Guys, is there any specification how to read these sequences, please? I'm just maintaining part of code which is blackbox for me so I'd like to know what I'm using in these keymap files...

@agaida agaida added this to Needs triage in Issues Jul 14, 2018
@agaida agaida moved this from Needs triage to Sprint in Issues Sep 15, 2018
yan12125 pushed a commit that referenced this issue Sep 30, 2018
Fixes #1

Notes about other terminals:

Konsole:
^? for backspace and ^H for ctrl+backspace

Gnome Terminal (VTE3):
- ^? for backspace and ^H for ctrl+backspace by default, and
- ^H for backspace and ^? for ctrl+backspace if the option
  "Backspace key generates:" is set to "Control-H"
@yan12125
Copy link
Member

Here's a fix => #218

Issues automation moved this from Sprint to Closed Sep 30, 2018
agaida pushed a commit that referenced this issue Sep 30, 2018
Fixes #1

Notes about other terminals:

Konsole:
^? for backspace and ^H for ctrl+backspace

Gnome Terminal (VTE3):
- ^? for backspace and ^H for ctrl+backspace by default, and
- ^H for backspace and ^? for ctrl+backspace if the option
  "Backspace key generates:" is set to "Control-H"
@agaida agaida added this to Done in Issues Jan 26, 2019
yan12125 pushed a commit that referenced this issue Mar 10, 2024
Fix issue cursor positioning issues
inventor2525 pushed a commit to inventor2525/qtermwidget that referenced this issue May 14, 2024
Fixes lxqt#1

Notes about other terminals:

Konsole:
^? for backspace and ^H for ctrl+backspace

Gnome Terminal (VTE3):
- ^? for backspace and ^H for ctrl+backspace by default, and
- ^H for backspace and ^? for ctrl+backspace if the option
  "Backspace key generates:" is set to "Control-H"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Issues
  
Closed
Issues
  
Done
Development

No branches or pull requests

4 participants