You are not logged in.

#1 2014-09-02 09:39:51

megadriver
Member
From: Spain
Registered: 2010-02-03
Posts: 58
Website

st terminal emulator and the Delete key

So I'm playing with st and I like it a lot, but there's something that's really driving me crazy mad

The Backspace key works as expected, but what should I do to make the Delete key delete forward? By default it doesn't do anything.

I've already read this, this and this, and I've tried many of the solutions offered. At best they make the Delete key delete backwards, like it was the Backspace key. At worst they cause both keys to either do nothing or print out stuff like "^H", "^?" or "[[P" sad

I've found a fix for Emacs (set 'normal-erase-is-backspace' to 't'), but no such luck with bash itself (I've also tried zsh, fish, mksh and tcsh just in case it was bash-specific; looks like it's not!) or other terminal programs. Is anyone else here having the same problem?

Offline

#2 2014-09-02 10:22:05

Steef435
Member
Registered: 2013-08-29
Posts: 577
Website

Re: st terminal emulator and the Delete key

Have you seen this, this and have you tried using "stty lnext ^V"?

What's the output of "stty -a"?

I don't know what your preferred shell is but this works for me on zsh:
Add to your .zshrc:

typeset -A key
key[Delete]=${terminfo[kdch1]}
[[ -n "${key[Delete]}"   ]]  && bindkey  "${key[Delete]}"   delete-char

And make sure that stty -a contains:

lnext = ^V;

EDIT: In short: erase  is the behavior you expect from backspace, lnext is the behavior you expect from delete. See "man stty" for details.

Last edited by Steef435 (2014-09-02 10:27:38)

Offline

#3 2014-09-02 10:55:35

megadriver
Member
From: Spain
Registered: 2010-02-03
Posts: 58
Website

Re: st terminal emulator and the Delete key

$ stty -a
speed 38400 baud; rows 53; columns 170; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = <undef>; stop = <undef>; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

Looks like "lnext" is already set to "^V".

Usually I use bash, but I've just tried zsh with a .zshrc including what you suggested. Still no luck.

And the weird thing is, in zsh (and only in zsh) the Home key doesn't work either, the End, PgUp and PgDown keys print out "~" and the Insert key prints out "h". Not sure if this could be some sort of clue about what the problem could be roll

Last edited by megadriver (2014-09-02 11:19:01)

Offline

#4 2014-09-02 12:11:37

Steef435
Member
Registered: 2013-08-29
Posts: 577
Website

Re: st terminal emulator and the Delete key

AFAIK that's normal, the wiki explains how to let them work as expected.

Have you seen "Why doesn't the Del key work in some applications?" on the st homepage?

Last edited by Steef435 (2014-09-02 12:11:50)

Offline

#5 2014-09-02 13:10:36

megadriver
Member
From: Spain
Registered: 2010-02-03
Posts: 58
Website

Re: st terminal emulator and the Delete key

Yes. I've tried to put "set enable-keypad on" in .inputrc. I've also tried 'printf "\033?1h\033=" >/dev/tty' and 'echo $(tput smkx) >/dev/tty'. But all these just make the Delete key act like the Backspace key (delete backwards) sad

Offline

#6 2014-09-02 15:26:04

Steef435
Member
Registered: 2013-08-29
Posts: 577
Website

Re: st terminal emulator and the Delete key

My knowledge of terminal emulators ends here I'm afraid. Hopefully someone else can help you out.

If you're using the git version, did you already try if the same happens with the stable version, or the other way around?

Offline

#7 2014-09-02 16:25:07

megadriver
Member
From: Spain
Registered: 2010-02-03
Posts: 58
Website

Re: st terminal emulator and the Delete key

Yes, I tried the stable version too. It's the same.

I think I've found the two changes in st's source code that cause this behavior. It's this one and this one. I'm going to revert them and see what happens tongue

EDIT: Success! big_smile

Last edited by megadriver (2014-09-02 16:33:45)

Offline

#8 2015-02-13 16:02:23

pablox
Member
From: /home/chile/santiago/
Registered: 2008-05-14
Posts: 183
Website

Re: st terminal emulator and the Delete key

I'm having this same issue... can you tell me how exactly did you solved it?

EDIT Nevermind! I found this:

https://github.com/jceb/st-patches/blob … _key.patch

Is yours?

Last edited by pablox (2015-02-13 20:08:29)


Geeks & Linux Atelier
An eye for an eye ... ends in making everybody blind -- Mahatma Gandhi
dotfiles

Offline

#9 2017-06-05 03:24:54

dylnmc
Member
Registered: 2017-06-05
Posts: 1

Re: st terminal emulator and the Delete key

I used

        { XK_Delete,        XK_ANY_MOD,     "\033[C\177",         +1,    0,    0},

This basically moves the cursor once to the right and then it deletes. I know it is a little hacky, but *shrug* I actually kind of like it. You should note that if the cursor is at the end of the line, then it deletes the last character on that line.

cheers

Last edited by dylnmc (2017-06-05 03:26:17)

Offline

#10 2017-06-05 18:50:33

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,783
Website

Re: st terminal emulator and the Delete key

Thanks for sharing. I'm going to go ahead and close this old thread now.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB