Re: Unexpected behaviour of Backspace when binding ^H

Benno Schulenberg <[email protected]> Wed, 11 Mar 2020 09:53:19 +0100
Newsgroups gmane.editors.nano.general
Message-ID <[email protected]>
Hello Ciprian,

Op 11-03-2020 om 01:47 schreef Ciprian Tomoiaga:

> Also, for the bug, do I understand correctly that it will only work with `nano
> -K` ?

It depends.  If your 'terminfo' terminal description describes correctly
what the <Backspace> key sends (^?), then rebinding ^H will work without
having to use -K.

But for the Sakura emulator on NomadBSD,

  infocmp | grep -o kbs=..

gives: ^H

But when I type ^V <Backspace> at the prompt, it says: ^?

Sakura uses a wrong terminal description, which means that when in
nano I type ^H, ncurses thinks I pressed the <Backspace> key and
sends KEY_BACKSPACE to nano.  When I type <Backspace>, ncurses does
not recognize the ^? and sends it untranslated to nano, and nano
assumes that an unrecognized ^? means: backspace.

So, by default, without any rebindings, ^H and <Backspace> will both
do a backspace, even when the terminal description is wrong.  But when
you want to rebind ^H, and your terminal description is wrong, you have
to stop ncurses from translating ^H to backspace by using -K.

> If so, does that mean mouse support will be disabled ?

Yes, when using -K/--rawsequences, the mouse cannot be used in nano.

Benno
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEv9AJBh5TUFKtDfIVDSjU0qCs6IQFAl5opwcACgkQDSjU0qCs
6IQtoRAApo4QTA2A9oQSL2l4azettx6tVpG69D3/RJrJrzpONhS+4XQtx1KW5J8y
3xyLY6d3jNqaU57/qdCxRR7ETaMTisBFKYWdQ6Z0RZfAtyG72VzNiP+PMt5MLF0T
sjRrbMh1i2X4y8pMCf9c5QjDVPFusQO5zF/PzQhYmQk6XSISxBTCNsd1S+DrXJJt
8xjuxp8q6Yk0GKW98kesBUFwpgJhEAD3MSWqBbsp9m8zDe0L3GmfcjZdbrPk8dpd
d4CfHGT0fwZ9YfSb3tMX9z3o3uSILKy7KZpGzVto7gJaRQDRGz3I72vlLPWxQ1v4
hCdXiMO4Z6aqBfsLHDJAvh+r2ieHKluuTdk8bMYYA+x+u10cSpM2cwZNmfhdTi/Y
lnGELEQwg8Az54+1D3QzRRpCLaIb+8TCoAB8HC8pC0xDAfHdeBfkft9ilfOYyjPR
xboAryRthEonZmD9fRLwxtBAsSK++SjWB71+p79PXdfo//LfgjfF4Ng+a/S90jIg
p4tNc3DrP0qUQ62hN04BnS9CQwG5X66EKkQq+F2GCPcQ154S3jD6BV2w2AYBQosW
vjeqEkMoWB5ju/20CF0xsKFxz5EEmWaK8T32jdE6/DQ+BsZ6u1q4iTwMOhw0FYko
Z7VUrUiOdHrfliaa+xuh1EOnCGZN2dHxSSPxD44R/UhsWstJHUY=
=zQMi
-----END PGP SIGNATURE-----