Warp icon indicating copy to clipboard operation
Warp copied to clipboard

In emacs, M-backspace sends M-b "ackspace"

Open jinschoi opened this issue 2 years ago • 1 comments

Discord username (optional)

No response

Describe the bug

Running emacs -nw (version 28.2) and hitting META-backspace (using option key with "option as meta" turned on), the cursor goes back one word and then "ackspace" is inserted into the buffer.

Typing "C-h k M-backspace" (describe-key) shows that what is being sent is M-b (backward-word) and then the string "ackspace". Similar for M-enter, it sends M-e nter (forward-sentence then "nter").

To Reproduce

  1. In Settings/Features, turn on both Left Option key is Meta and Right Option Key is Meta.
  2. Run emacs -nw
  3. Switch to the scratch buffer.
  4. Type META-backspace. The cursor will jump back one word and "ackspace" will be inserted.

Expected behaviour

The previous word should be deleted (i.e., META-backspace should be sent).

Screenshots

No response

Operating System

MacOS

OS Version

12.6

Shell Version

zsh 5.8.1

Warp Version

v0.2022.09.13.08.15.stable_03

Additional context

No response

Does this block you from using Warp daily?

Yes

Warp Internal (ignore): linear-label:b8107fdf-ba31-488d-b103-d271c89cac3e

No response

jinschoi avatar Sep 21 '22 18:09 jinschoi

Hey @jinschoi, thanks for reporting. I was able to repro this. We'll look into this!

szgupta avatar Sep 21 '22 19:09 szgupta

Hi, do you have any updates on this? This is pretty annoying for me and I imagine several dozen other emacs users as well.

rlanday avatar Dec 14 '22 17:12 rlanday

This isn't limited to emacs. Whenever Warp is in alternate screen, it sends this amusing and bizarro sequence.

weird-keymap

This script enters alternate screen, and then I used a couple of arrow keys, hit backspace (which shows as ^?), mashed the keys a bit and finally hit Option+Backspace, and you can see it then send ESC "backspace" (ESC+b is Meta-b, and ESC shows as "^[")

check-term-keybind.tgz

Emacs keybindings entered widespread use through GNU ReadLine and their default availability in GNU bash and other applications that adopted ReadLine or implemented Emacs bindings, which generally do not interfere/conflict with common standard Windows/MacOS edit keys. As a result, many sequences have found their way into other applications, sometimes in a misconceived way.

The one I miss most is ^_, 0x1F or Ctrl+Shift+Minus on US keyboards, which is Undo in Emacs (and by extension Bash). That sequence doesn't send anything in Warp. This seems like an oversight/omission, too; and you know, you can look at the lower parts of the ASCII table:

@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\]^_ 

The escape code when you hit Control + the Letter is the same code but minus 0x40. The ones that aren't letters might involve Shift as well, but they all work. Emacs uses ^@ for "Set Mark" (starting a selection region at the current point, like you'd do with a mouse) and ^_ for Undo.

I've noticed that ^K is quite common now, and ^U as well, though I wish people would not make ^U kill the whole line: in bash, it kills to the start of line only, and leaves everything after the cursor as it was.

If you use bind -P | less in bash, you can see even more keystroke bindings you might not know about. I've blown people's minds before using features like Undo, Cut and Paste (including cycling through the "kill ring" with M-y) or Reverse Searching with ^R: in the humble bash terminal, but these bindings all come from Emacs.

Anyway, hope this helps and I'm happy to give feedback/testing if you want to sent me a branch build or something.

samv avatar Apr 15 '23 04:04 samv

Also seeing this in tmux (unsurprisingly given the above), can we please get an update on this?

tylerFowler avatar Jul 25 '23 00:07 tylerFowler

Hey all, thanks for your patience -- I'll start looking into a fix for this

zachbai avatar Aug 02 '23 23:08 zachbai

+1, in tmux

ejoubaud avatar Aug 19 '23 16:08 ejoubaud

Hey all, we merged a fix for this a couple releases ago -- is the issue resolved on your end?

zachbai avatar Sep 07 '23 17:09 zachbai

The one I miss most is ^_, 0x1F or Ctrl+Shift+Minus on US keyboards, which is Undo in Emacs (and by extension Bash). That sequence doesn't send anything in Warp. This seems like an oversight/omission, too; and you know, you can look at the lower parts of the ASCII table:

I got a similar issue, when I use option+e in emacs, it prints out ´ instead of jumping to the end of the paragraph, I turned on "left option and right option as meta key" in warp

JackYansongLi avatar Sep 23 '23 05:09 JackYansongLi

@JackYansongLi mind filing a separate issue? Sounds like the cause might be slightly different.

I'm going to close this one since the fix seems to have worked (at least, to stop sending that bizarre M-b 'ackspace' sequence

zachbai avatar Sep 25 '23 17:09 zachbai