fzf icon indicating copy to clipboard operation
fzf copied to clipboard

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

Open haosdent opened this issue 3 years ago • 8 comments

haosdent avatar Mar 25 '22 07:03 haosdent

In my terminal, they are not the same.

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

junegunn avatar Mar 30 '22 01:03 junegunn

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 avatar Mar 30 '22 01:03 haosdent

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

haosdent avatar Mar 30 '22 01:03 haosdent

#!/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

junegunn avatar Mar 30 '22 02:03 junegunn

What I got

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

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

haosdent avatar Mar 30 '22 02:03 haosdent

image This is your backspace key, right?

haosdent avatar Mar 30 '22 02:03 haosdent

Sure 🤣

Related: https://github.com/microsoft/terminal/issues/5957#issuecomment-630659076

junegunn avatar Mar 30 '22 02:03 junegunn

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

haosdent avatar Mar 30 '22 02:03 haosdent