10:07 pm, 26 Jul 04
Debian, Terminal.app, backspace, and color
I finally figured out the OS X terminal problems. (Google fodder:) I now have color and backspace working in Debian xterms and Terminal.app.
The original problem was that backspace wasn't working in some programs when I ssh'd into my Debian box.
Matt, who's usually on top of all of this, suggested I check the "backspace sends delete" option in Terminal.app. But this not only didn't fix the problem (instead reversing the two sets of working/nonworking programs), it also makes it so I no longer have separate ^H and ^? keys.
After a lot of digging, I found that a terminal type of xterm (instead of xterm-color) made things work right, at the cost of color in my OS X terminals. Matt and I verified that either TERM setting works on his BSD box and on the Redhat UWCS* machines, so it's probably Debian's fault in some way. (Knowing Debian, they're probably following some standard and everyone else is violating it because that's what makes things work.) Rather than trying to change all of the Debian machines I use, I just copied the xterm terminfo over the xterm-color terminfo in OS X. (If you're looking to do this, it's in /usr/share/terminfo/78.)
The other problem I was having was my UTF-8 mutt was all corrupted. It turned out to be a simple setting: the "Wide glyphs for Japanese/Chinese/etc." option in Terminal.app was also making the Unicode line-drawing characters double width. This, coupled with it wrapping the extra-long lines, means that the lines following these doublewidth characters were indented, which corrupted the next line, and so on.
The final thing that was driving me nuts was happily fixable: I made pgup/pgdn send those keys and fn-pgup and fn-pgdn into the terminal scrollback, like I'm used to elsewhere.
* UWCS = University of Washington Computer Science.
The original problem was that backspace wasn't working in some programs when I ssh'd into my Debian box.
Matt, who's usually on top of all of this, suggested I check the "backspace sends delete" option in Terminal.app. But this not only didn't fix the problem (instead reversing the two sets of working/nonworking programs), it also makes it so I no longer have separate ^H and ^? keys.
After a lot of digging, I found that a terminal type of xterm (instead of xterm-color) made things work right, at the cost of color in my OS X terminals. Matt and I verified that either TERM setting works on his BSD box and on the Redhat UWCS* machines, so it's probably Debian's fault in some way. (Knowing Debian, they're probably following some standard and everyone else is violating it because that's what makes things work.) Rather than trying to change all of the Debian machines I use, I just copied the xterm terminfo over the xterm-color terminfo in OS X. (If you're looking to do this, it's in /usr/share/terminfo/78.)
The other problem I was having was my UTF-8 mutt was all corrupted. It turned out to be a simple setting: the "Wide glyphs for Japanese/Chinese/etc." option in Terminal.app was also making the Unicode line-drawing characters double width. This, coupled with it wrapping the extra-long lines, means that the lines following these doublewidth characters were indented, which corrupted the next line, and so on.
The final thing that was driving me nuts was happily fixable: I made pgup/pgdn send those keys and fn-pgup and fn-pgdn into the terminal scrollback, like I'm used to elsewhere.
* UWCS = University of Washington Computer Science.
infocmp -L > foo
vi foo
tic foo
or something like that. (I use this to turn off ti/te permanently, so I don't know offhand which sequences to remove or add to get the behavior you're looking for.)
Would you mind explaining how you did this? Every way I've ever heard of doing so sounded half-baked.
It works! Thank you.
Termcaps and their interactions with various SSH/telnet clients and other software have always been one of those things I always say I'm going to figure out later but never do.
It seems like every system I log into has a different idea what control sequences mean backspace, pgup, left, right etc. My own Debian box works okay with the defaults in my client, but the Red Hat Linux box at my university doesn't like Home/End although it manages most other things. The old SunOS box is even worse, not even liking backspace, delete and the arrow keys. Once I add screen into the mix it gets even worse, since apps start complaining they don't know what a terminal type “screen” is, and I always end up just saying export TERM=xterm because I just remembered that worked once.
One of these days I really must figure out how all this termcap and terminal settings stuff works so that I can actually get a consistent set of working keys across every UNIXy box I SSH to. Heh.
I generally leave PgUp and PgDn to be sent to the server and use Ctrl+PgUp or Shift+PgUp to manipulate the scrollback in my client. It's handy when I'm using an app which has a scrolly section within it, like Pine. Although I've heard noises before that a decent terminal should be able to scrollback just that region of the screen, I've never seen a terminal emulator that can do it.
Terminal/termcap/terminfo/ncurses etc are confusing bastards. There's a great deal of deep voodoo lurking in all that.
utf-8 mutt
Thank-you soooo much!!! The mutt display problem was driving me crazy. I had almost given up!/joeyo
a mac os x user who often secure shells into a debian box for mutt
(The wide characters for japaneses was getting me.)
Almost five years later...
and the same bullshit still applies. At least I remembered this post after banging my head on my desk for an hour.