You are not logged in.

#1 2016-12-10 10:49:46

woodape
Member
Registered: 2015-03-25
Posts: 159

Configure ST Terminal Delete Key

I've been having an issue with the 'st' terminal delete key from suckless. By default pressing the delete key doesn't "erase forward" and the delete patch from the website actually only disables backspace for me. I found their FAQ describing the issue with terminfo and how some programs don't respect some proper coding (I don't really understand all these details but they're there), and their recommendation of trying "printf '\033[?1h\033=' >/dev/tty" works, and changing the inputrc to include "set enable-keypad on"  works in the terminal but not with ncurses programs like ncmpcpp. Putting the printf statement in my bashrc, allows me to use delete when I open a terminal interactively, but not when I do for instance "st -e ncmpcpp". It doesn't work if I do "st -e /bin/bash -c ncmpcpp", but "st -e /bin/bash -i -c ncmpcpp" does.

In general though this seems like it should be configured in the terminal, and I shouldn't "have" to make special statements in my bashrc for a particular terminal emulator. Is anyone experinced enough with these special keycodes and st to be ble to tell be how to change my config.h to do whatever is happeneing in "printf '\033[?1h\033=' >/dev/tty"? I think the relveant parts of my config.h are as follows:

	{ XK_KP_Insert,      XK_ANY_MOD,     "\033[2~",      +1,    0,    0},
	{ XK_KP_Delete,     ControlMask,         "\033[M",        -1,    0,    0},
	{ XK_KP_Delete,     ControlMask,         "\033[3;5~",   +1,    0,    0},
	{ XK_KP_Delete,     ShiftMask,             "\033[2K",       -1,    0,    0},
	{ XK_KP_Delete,     ShiftMask,             "\033[3;2~",    +1,    0,    0},
	{ XK_KP_Delete,     XK_ANY_MOD,     "\033[P",         -1,    0,    0},
	{ XK_KP_Delete,     XK_ANY_MOD,     "\033[3~",      +1,    0,    0},
	{ XK_KP_Multiply,   XK_ANY_MOD,     "\033Oj",        +2,    0,    0},
...
	{ XK_Delete,        ControlMask,          "\033[M",       -1,    0,    0},
	{ XK_Delete,        ControlMask,          "\033[3;5~",  +1,    0,    0},
	{ XK_Delete,        ShiftMask,              "\033[2K",      -1,    0,    0},
	{ XK_Delete,        ShiftMask,              "\033[3;2~",   +1,    0,    0},
	{ XK_Delete,        XK_ANY_MOD,     "\033[P",         -1,    0,    0},
	{ XK_Delete,        XK_ANY_MOD,     "\033[3~",      +1,    0,    0},
	{ XK_BackSpace,     XK_NO_MOD,  "\177",             0,    0,    0},
	{ XK_BackSpace,     Mod1Mask,       "\033\177",      0,    0,    0},

Offline

#2 2016-12-11 04:00:33

adamlau
Member
Registered: 2009-01-30
Posts: 418

Re: Configure ST Terminal Delete Key

Try using the native st terminfo database. Compile it with:

tic -sx st.info

Move the file to ~/.terminfo.cdb or /usr/share/terminfo.cdb (manually or from within the PKGBUILD)

strace -f st 2>&1 | grep open

...to verify that st picked up the terminfo database...

Last edited by adamlau (2016-12-11 04:01:31)


Arch Linux + sway
Debian Testing + GNOME/sway
NetBSD 64-bit + Xfce

Offline

#3 2016-12-11 07:36:47

woodape
Member
Registered: 2015-03-25
Posts: 159

Re: Configure ST Terminal Delete Key

Thanks for the comment. I've done the commands, the first actually produces "~/.terminfo/s/" with st, st-256color, st-meta, st-meta-256color. I moved this whole directory to .terminfo.cdb, and each file by itself to .terminfo.cdb, and reran the strace each time. Everytime st picked up the "~/.terminfo/s/st-256color" file:

[pid  9579] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid  9579] open("/usr/lib/libncursesw.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9579] open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9579] open("/home/bam/.terminfo/s/st-256color", O_RDONLY) = 3
[pid  9582] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid  9582] open("/usr/lib/libncursesw.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9582] open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9582] open("/home/bam/.terminfo/s/st-256color", O_RDONLY) = 3
[pid  9585] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid  9585] open("/usr/lib/libncursesw.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9585] open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9585] open("/home/bam/.terminfo/s/st-256color", O_RDONLY) = 3
[pid  9587] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid  9587] open("/usr/lib/libncursesw.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9587] open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9587] open("/home/bam/.terminfo/s/st-256color", O_RDONLY) = 3
[pid  9590] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid  9590] open("/usr/lib/libncursesw.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9590] open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9590] open("/home/bam/.terminfo/s/st-256color", O_RDONLY) = 3
[pid  9592] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid  9592] open("/usr/lib/libncursesw.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9592] open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9592] open("/home/bam/.terminfo/s/st-256color", O_RDONLY) = 3
[pid  9594] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid  9594] open("/usr/lib/libncursesw.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9594] open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9594] open("/home/bam/.terminfo/s/st-256color", O_RDONLY) = 3
[pid  9597] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid  9597] open("/usr/lib/libncursesw.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9597] open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid  9597] open("/home/bam/.terminfo/s/st-256color", O_RDONLY) = 3
[pid  9574] open("/usr/share/z/z.sh", O_RDONLY) = 3

It doesn't look like it picked up the .terminfo.cdb file, further verified by grepping the output for "terminfo.cdb" instead of "open".

Any ideas?

Offline

#4 2016-12-11 22:22:54

adamlau
Member
Registered: 2009-01-30
Posts: 418

Re: Configure ST Terminal Delete Key

My mistake. My comments were directed towards st built against netbsd-curses. ncurses tic will behave as you describe.


Arch Linux + sway
Debian Testing + GNOME/sway
NetBSD 64-bit + Xfce

Offline

Board footer

Powered by FluxBB