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

Fix alt+bspace since alt+bspace is equal to alt+ctrl+h. #2771

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

haosdent
Copy link

No description provided.

@junegunn
Copy link
Owner

In my terminal, they are not the same.

BSPACE: "\u007F"
ALT-BSPACE: "\e\u007F"
CTRL-H: "\b"
CTRL-ALT-H "\e\b"

@haosdent
Copy link
Author

Wired, @junegunn do you use xxd command to find it. And according to https://www.physics.udel.edu/~watson/scen103/ascii.html bspace should equal to ctrl+h as well.
image

@haosdent
Copy link
Author

Here is my xxd output when type alt+bspace

 xxd
^[^H^[^H^[^H^[^H^[^H^[^H^[^H^[^H^[^H^[^H^[^H^[^H^[^H^[^H
00000000: 1b08 1b08 1b08 1b08 1b08 1b08 1b08 1b08  ................

@junegunn
Copy link
Owner

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'io/console'

loop do
  chars = $stdin.getch + (begin
                            $stdin.read_nonblock(1024)
                          rescue StandardError
                            ''
                          end)
  break if [3, 4, 26].map(&:chr).include?(chars)

  p chars
end

@haosdent
Copy link
Author

What I got

> Alt+Backspace
"\e\b"
"\e\b"
"\e\b"

> Ctrl+H or Backspace
"\u007F"
"\u007F"
"\u007F"
"\u007F"
"\u007F"

@haosdent
Copy link
Author

image
This is your backspace key, right?

@junegunn
Copy link
Owner

Sure 🤣

Related: microsoft/terminal#5957 (comment)

@haosdent
Copy link
Author

gg, but by right alt+ctrl+h and alt+bspace should have the same effect according to my trial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants