[comp.sources.bugs] curses/termcap vs. autowrap on DEC terminals

dag@per2.UUCP (Daniel A. Glasser) (05/03/89)

[[ I realize that this has probably been covered before.  I am posting ]]
[[ this because some people are still running into this problem.       ]]

There is a problem with some implementations of the curses library
in its interpretation of the autowrap on DEC terminals (VT100 and
later).

The specific problem is that the curses screen update routines
believe that if a character is written into column 80 that the
cursor is left in column 1 of the next line.  The actual behavior
is that the cursor remains displayed in column 80 and does not
move until the next character is received.  If the next character
is a linefeed, the cursor moves down to column 80 of the next line
and the next character received (assuming it is printable) will be
displayed in column 80 of that line.  This is also true of the
relative up/down positioning sequences.

Many "VT100" clones/emulators do not mimmick the DEC terminal behavior
properly.  Some do.  The best bet when you find programs screwing up
the screen display through curses is to make sure the tab settings
on the terminal are the default 8 column tabs (9 17 25 ...), that
the TERMCAP entry for the terminal has auto margins false and that the
terminal itself has autowrap turned off (this should actually not
be required).

-- 
 _____________________________________________________________________________
    Daniel A. Glasser                           One of those things that goes
    uwvax!per2!dag                              "BUMP!!!(ouch)" in the night. 
 ---Persoft, Inc.---------465 Science Drive-------Madison, WI 53711-----------

nelson@sun.soe.clarkson.edu (Russ Nelson) (05/03/89)

In article <853@per2.UUCP> dag@per2.UUCP (Daniel A. Glasser) writes:

   Many "VT100" clones/emulators do not mimmick the DEC terminal behavior
   properly.

As best as I can tell, screen(1) gets it right (after being patched with
bug fixes posted to this group).
--
--russ (nelson@clutx [.bitnet | .clarkson.edu])
I'm a right-to-lifer -- everyone has a right to earn a living sufficient to
feed himself and his family.

peter@ficc.uu.net (Peter da Silva) (05/03/89)

In article <853@per2.UUCP>, dag@per2.UUCP (Daniel A. Glasser) writes:
> the TERMCAP entry for the terminal has auto margins false and that the
> terminal itself has autowrap turned off (this should actually not
> be required).

This is in fact required... suppose 'vi' is displaying a long line. It gets to
column 80 and wants to put the next character at column 1 on the next line. If
autowrap is on, it's there. If autowrap is off, it has to send a CR and an LF.

If you tell vi the terminal has no autowrap when it in fact does, it will put
a blank line in the middle of any line longer than 80 characters.
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.

Business: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180.
Personal: ...!texbell!sugar!peter, peter@sugar.hackercorp.com.

allbery@ncoast.ORG (Brandon S. Allbery) (05/08/89)

As quoted from <853@per2.UUCP> by dag@per2.UUCP (Daniel A. Glasser):
+---------------
| Many "VT100" clones/emulators do not mimmick the DEC terminal behavior
| properly.  Some do.  The best bet when you find programs screwing up
| the screen display through curses is to make sure the tab settings
| on the terminal are the default 8 column tabs (9 17 25 ...), that
| the TERMCAP entry for the terminal has auto margins false and that the
| terminal itself has autowrap turned off (this should actually not
| be required).
+---------------

Alternatively, set the ":xn:" attribute in the termcap and leave auto-wrap
on.  ("xn" means that a linefeed from column 0 doesn't always get acted upon;
this basically avoids the problem, since curses thinks it's in column 0 when
the VT[12]xx thinks it's in column 80+.)

I use this on many systems with no problems.

++Brandon
-- 
Brandon S. Allbery, moderator of comp.sources.misc	     allbery@ncoast.org
uunet!hal.cwru.edu!ncoast!allbery		    ncoast!allbery@hal.cwru.edu
      Send comp.sources.misc submissions to comp-sources-misc@<backbone>
NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser