|
|
Log in / Subscribe / Register

Terminals crap on greater than 80 columns

Terminals crap on greater than 80 columns

Posted Jun 5, 2004 0:06 UTC (Sat) by smoogen (subscriber, #97)
Parent article: The Grumpy Editor's guide to terminal emulators

Here is my grumpy user setting. I was given one of those new fangled 24 inch monitors and it has quite a bit of screen space. So I try bringing the xterm up to 256x80 so I can look at logs.. and if I type beyond the 80 characters, I get xterm hell.. line redraws that make no sense, and my editing becomes a couple of characters, ^L, couple of characters, ^L, etc etc.

All the terminals I have tried (konsole, gnome-terminal, xterm, rxvt) all seem to exhibit this.. so I am figuring I must be doing something wrong :).
It pretty much happens right after I move past the 81-84 column...

oh well.. I should be happy to be blessed with vision that can read such small characters.


to post comments

Terminals crap on greater than 80 columns

Posted Jun 5, 2004 1:02 UTC (Sat) by madscientist (subscriber, #16861) [Link] (1 responses)

You're right, you've got something wrong. Almost certainly your terminal type (in the TERM environment variable) is set incorrectly. Things like the end of line handling, etc. are not controlled by the terminal emulator: it's emulating the terminal!! The program you run inside the emulator is responsible for handling what happens when the cursor gets to the end of the line. If you "echo $TERM" what does it say? Probably "dumb" or something like that.

A safe bet with all the terminal emulators is to use a terminal type of vt100. That's powerful enough to handle most editing commands. Also you can try either xterm or vt220 if you like. Just set them in your environment before you start your xterm/whatever. You don't say what kind of desktop you have but you can put it in your .xinitrc, or .gnomerc, or whatever else as well. Don't forget to export it:

TERM=vt100
export TERM

Terminals crap on greater than 80 columns

Posted Jun 5, 2004 14:40 UTC (Sat) by smoogen (subscriber, #97) [Link]

echo ${TERM}
xterm

I tried various other terms also to see if it fix it.. Sorry I thought I mentioned that in my first post.

Terminals crap on greater than 80 columns

Posted Jun 5, 2004 2:01 UTC (Sat) by jwb (guest, #15467) [Link] (5 responses)

Ah, after using UNIX and variants for over a decade I finally discovered the source of this utterly baffling problem. And now I will share my hard-gained wisdom with you, gentle readers:

The problem is SIGWINCH. Let's say you call up an xterm in your favorite 80x25 or 80x40 or 120x40 etc. Then you invoke your favorite pager on some really wide file. The lines are wrapped, so you make the xterm wider. This works fine. Afterwards, you go back to the shell, but your long command lines are all screwed up! Egads!

What's happened is SIGWINCH, the signal sent to programs when the size of the controlling terminal changes, we delivered to your pager (less, more, whatever). It was NOT delivered to your shell. So the shell, which is probably using readline for command editing, has no idea the terminal is now 281 characters across. This causes major problems inside the readline library, and is why editing long command lines often barfs.

The workaround: just resize the terminal a bit when you see the problem. This will deliver the SIGWINCH to the program you are currently using, and make everything look correct again.

A real solution would be for the shell (or readline, or some other bit of code) to check the size of the controlling terminal whenever it resumes control of it, when children exit, or whenever it might have changed unnoticed.

Terminals crap on greater than 80 columns

Posted Jun 5, 2004 7:56 UTC (Sat) by glettieri (subscriber, #15705) [Link] (2 responses)

In bash, just do:

shopt -s checkwinsize

Don't think this is the problem smoogen was having, though...

Terminals crap on greater than 80 columns

Posted Jun 5, 2004 14:43 UTC (Sat) by tzafrir (subscriber, #11501) [Link] (1 responses)

another option: maximize the window, and restore (pressing alt-F10 twice, in default icewm settings).

Terminals crap on greater than 80 columns

Posted Jun 5, 2004 15:06 UTC (Sat) by glettieri (subscriber, #15705) [Link]

I guess my previous post was a little bit cryptic :)
You don't have to type that command each time readline goes out of sync with the window size. If you turn the 'checkwinsize' option on, bash will chech the window size after each command. Put the 'shopt -s ...' in your rc file and the problem is gone forever...

Terminals crap on greater than 80 columns

Posted Jun 5, 2004 15:05 UTC (Sat) by vivek (guest, #6962) [Link] (1 responses)

kill -WINCH $$ usually does the trick when the window size has
been changed behind the emulator's back.

Terminals crap on greater than 80 columns

Posted Jun 7, 2004 19:10 UTC (Mon) by Ross (guest, #4065) [Link]

But why does this work in xterm by default but not in kterm? In any case
I'm able to fix it by running the "resize" program but I shouldn't have to.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds