LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   TERM=rxvt / rxvt-unicode and ctrl-L (http://www.linuxquestions.org/questions/slackware-14/term%3Drxvt-rxvt-unicode-and-ctrl-l-796388/)

irb 03-18-2010 06:22 PM

TERM=rxvt / rxvt-unicode and ctrl-L
 
This has been a nagging problem for quite a while with Slackware and I'm curious if others have seen it. If, using any sort of rxvt-based terminal with TERM set to rxvt (or rxvt-unicode) then ^L will not clear the screen, only act as newline. This is not the behavior I see on Debian or CentOS. I have the same user environment at each site.

Using urxvt on centos, ^L will clear the screen like readline(3) says it should. If I then ssh to slackware, it won't.

exporting TERM=xterm will cause the correct behavior after having logged in to slackware, but I'd rather understand why this is happening.

I've tried moving aside all the shell startup scripts, setting clear-screen explicitly in .inputrc, setting stty sane ... nothing doing. Am I missing something?

Thanks.

dive 03-18-2010 06:29 PM

Seems to work here with urxvt at least while not in vim/irssi. I have no settings in .inputrc for it.

T3slider 03-18-2010 07:41 PM

Doesn't work here in urxvt either. In default GNU screen it works so it didn't bother me (it is quite rare that I use a terminal without using screen as well), but after switching to using term screen-256color-bce to get my full colour fix I've lost that capability again. I haven't done anything about since it is easy enough to type `clear` but I guess some terminfo files are just not very complete.

irb 03-19-2010 01:50 AM

Quote:

Originally Posted by T3slider (Post 3903864)
Doesn't work here in urxvt either. In default GNU screen it works so it didn't bother me (it is quite rare that I use a terminal without using screen as well), but after switching to using term screen-256color-bce to get my full colour fix I've lost that capability again. I haven't done anything about since it is easy enough to type `clear` but I guess some terminfo files are just not very complete.

Yeah, in screen it's fine, unless I ssh into another slackware box, where it stops working for the duration of that session (whose TERM is set to screen-bce or screen-256color-bce as well). Hunh.

GrapefruiTgirl 03-19-2010 02:03 AM

On my slackware machine, 'rxvt' is not one of the possibilities in the /etc/termcap file in the section which includes 'xterm'. As such, I had the same behavior as you do, i.e. CTRL-L would not clear the screen. By adding 'rxvt' into the list of TERM possiblities in the section where 'xterm' is listed, CTRL-L now works as expected in my rxvt.

The corresponding section of my /etc/termcap file looks like this (note where I inserted rxvt):

Code:

# Entry for an xterm. Insert mode has been disabled.
vs|rxvt|xterm|xterm-color|vs100|xterm terminal emulator (X Window System):\
        :am:bs:mi@:km:co#80:li#55:\
        :im@:ei@:\
        :ct=\E[3k:ue=\E[m:\
        :is=\E[m\E[?1l\E>:\
        :rs=\E[m\E[?1l\E>:\
        :eA=\E)0:as=^N:ae=^O:ac=aaffggjjkkllmmnnooqqssttuuvvwwxx:\
        :kI=\E[2~:kD=\177:kP=\E[5~:kN=\E[6~:\
        :k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\
        :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k0=\E[21~:\
        :F1=\E[23~:F2=\E[24~:\
        :kh=\E[H:kH=\EOw:\
        :ks=:ke=:\
        :te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:\
        :tc=vt-generic:

Also, note that I just did this for the heck of it, to test before posting here, so I have not tested the other entries in this section of the file to see if the rest of the codes work in rxvt -- you really should probably create a unique section specifically for rxvt, such as has been done for other terminals like for e.g. Eterm.

Sasha

Thom1b 03-19-2010 02:56 AM

I made a slackbuild for slackware-fr.org called rxvt-unicode-terminfo.
Then you can keep TERM=rxvt-unicode and everything will work. This is very useful if you want to connect on a ssh server who hasn't rxvt-unicode installed from a rxvt-unicode terminal. Just install the terminfo on the server.

irb 03-20-2010 11:02 AM

Quote:

Originally Posted by GrapefruiTgirl (Post 3904161)
On my slackware machine, 'rxvt' is not one of the possibilities in the /etc/termcap file in the section which includes 'xterm'. As such, I had the same behavior as you do, i.e. CTRL-L would not clear the screen. By adding 'rxvt' into the list of TERM possiblities in the section where 'xterm' is listed, CTRL-L now works as expected in my rxvt.

Sasha

For some reason I thought /etc/termcap was obsoleted by the entries in /usr/share/terminfo; perhaps not. I've added a termcap entry for rxvt-unicode and can now ^L all day. FYI, this is what I ended up using:

Code:

#      Reconstructed via infocmp from file: /etc/terminfo/r/rxvt-unicode
# (untranslatable capabilities removed to fit entry within 1023 bytes)
rxvt-unicode|rxvt-unicode terminal (X Window System):\
        :am:bw:eo:hs:km:mi:ms:xn:xo:\
        :co#80:it#8:li#24:lm#0:\
        :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\
        :K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\
        :RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ae=\E(B:al=\E[L:\
        :as=\E(0:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:\
        :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:\
        :dl=\E[M:do=^J:ds=\E]2;\007:ec=\E[%dX:ei=\E[4l:fs=^G:\
        :ho=\E[H:i1=\E[!p:ic=\E[@:im=\E[4h:\
        :is=\E[r\E[m\E[2J\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001 1049l\E[4l:\
        :k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\
        :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:kD=\E[3~:\
        :kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:kd=\E[B:ke=\E>:\
        :kh=\E[7~:kl=\E[D:kr=\E[C:ks=\E=:ku=\E[A:le=^H:mb=\E[5m:\
        :md=\E[1m:me=\E[m\017:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:\
        :se=\E[27m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\
        :te=\E[r\E[?1049l:ti=\E[?1049h:ts=\E]2;:ue=\E[24m:\
        :up=\E[A:us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:\
        :vs=\E[?25h:

Thanks for helping me track it down.

/i.

GrapefruiTgirl 03-20-2010 03:24 PM

I too am sometimes not sure which file supercedes which other files, or which are obsoleted by another. I think this can also vary by OS, and by compilation options of certain programs (such as term emulators). Based on what you write above, it looks fair to say that `infocmp` uses the /etc/terminfo* information, and produces output that can be used in /etc/termcap?

I'm going to keep your above post handy as a reference; I did not know of `infocmp` and I just tried it in my xterm and it produced a load of stuff! I can probably tune up all my terminals to some degree.

I haven't looked into it yet, but what I now wonder, is if a local termcap file is possible, such as ~/.termcap for example, which one could use to prevent the case of a system upgrade or whatever, overwriting your customized /etc/termcap file.

I am currently (among other things-- I get distracted easily) doing all sorts of configurating of various terminals on my system, so that everything works happily between terminals, $TERM variables, $LOCALE variables, LS_COLORS in terminals with different background-colors, and curses apps like MC and pkgtools -- because usually when *most* things are working great, there's usually *one* thing that gets screwed up; and fixing THAT thing, screws up something else. A local termcap file in the $HOME folder would make sense.

Anyhow, if you happen to read about if a $HOME/.termcap file can be used, please do tell; if I figure it out before you, I'll update this post.

EDIT - according to the termcap man-page, termcap is indeed obsoleted by terminfo.... I wonder then, why termcap is still being used, at least in this particular circumstance. There's probably a nice document about this somewhere :p which I'll look for later.


Sasha

irb 03-21-2010 12:09 AM

Quote:

Originally Posted by GrapefruiTgirl (Post 3905824)
Anyhow, if you happen to read about if a $HOME/.termcap file can be used, please do tell; if I figure it out before you, I'll update this post.

EDIT - according to the termcap man-page, termcap is indeed obsoleted by terminfo.... I wonder then, why termcap is still being used, at least in this particular circumstance. There's probably a nice document about this somewhere :p which I'll look for later.
Sasha

Yeah, running it through strace confirms that ~/.terminfo is read before /usr/share/terminfo. I'm surpised that termcap supersedes it though (or that it's incomplete?).

I'm still playing with it--the simple solution is to just use xterm as $TERM but I feel like being stubborn about it and making things work the Right Way. Though I can now do 256-color urxvt / screen there are some things that just don't seem to want to work right, like running "tome -mgcu" (it acts like it's an 8-color terminal). Elinks works fine though. Weird.

If I come up with a better terminfo entry I'll be sure to post it here. It seems to work better under CentOS which, as a Slackware bigot, is just unacceptable. *grin*

/i.

GrapefruiTgirl 03-21-2010 01:20 AM

The simple solution you propose -- using xterm as a blanket replacement in $TERM -- works for *most* things, and I did that for a while, even setting TERM=xterm in /etc/profile; but I think you will find that it does screw up *some* obscure things, particularly VT's.

I too have been messing with this off and on for some time -- most recently the last several hours. It makes me want to put my head in a vise at times :/ because when it *appears* that I've got everything working, I later find something else messed up. Plus, you can't neglect the VT Linux Console -- under some situations, it doesn't work right at all, when the $TERM variable is not what it wants it to be (linux).

xterm and rxvt are pretty compatible. Eterm is not. But despite the vast differences between say Eterm and xterm (in infocmp), I can set $TERM=xterm and most things work correctly in Eterm. But like you, *most* is not satisfactory enough, so the struggle continues. When I use Eterm, with TERM=Eterm, and start mcedit, I cannot use SHIFT+direction keys to highlight/select text -- instead I get letters, like a,b,c,d.

FWIW, I don't use `screen` very often (I prefer DVTM), because when I do use screen it seems that $TERM is ignored or changes to something else (never checked it though, that was a while ago)

Good luck! And, maybe since this thread is solved, you or I should start a new thread on the subject? Last time I spent a lot of time on this, I had started this thread over here: http://www.linuxquestions.org/questi...t=ncurses+mess

Maybe Eterm just sucks -- but I kinda like it still, and I'd like it to work :)

Sasha

catkin 06-09-2010 05:09 AM

The termcap entry posted by irb may have been mangled during copy-and-paste. There may be a missing ";" in
Code:

:is=\E[r\E[m\E[2J\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001[HERE]1049l\E[4l:\
The reason for thinking so is that it is otherwise functionally identical to both the termcap entry produced by the infocmp -C rxvt-unicode command and the termcap entry created during SlackBuild.

This when using Slackware 13.1 and SlackBuild's unicode-urxvt 9.07 build (creates SBo/rxvt-unicode-9.07/doc/etc/rxvt-unicode.termcap urxvt.termcap.sbo, possibly by running infocmp -C rxvt-unicode).

When using the posted termcap, I was unable to login after launching urxvt with /usr/bin/urxvt <some options> -e /bin/su - root. After inserting a ";" as above it works OK.


All times are GMT -5. The time now is 11:54 AM.