On Mon, Oct 17, 2005 at 07:10:05AM +0200, David Christensen wrote:
> Thomas Dickey wrote:
> > Now go back and use infocmp to compare putty (and of course, you're
> > using "putty" for $TERM, right?), against cygwin.  The difference
> > that usually seems applicable here is the "bw" capability.
> 
> Here is PuTTY on a Debian 3.0 machine:

ok.  But only a small part of the terminfo is used in top.  Offhand I would
have guessed a mismatch between the terminal and the terminfo, but I don't see
it.  Looking at top.c (part of procps), there is this chunk which deals with
the terminfo part:

      if (!eat_newline_glitch) {  // we like the eat_newline_glitch 
         CAPCOPY(Cap_rmam, exit_am_mode);
         CAPCOPY(Cap_smam, enter_am_mode);
         if (!*Cap_rmam || !*Cap_smam) {  // need both 
            *Cap_rmam = '\0';
            *Cap_smam = '\0';
            if (auto_right_margin) {
               avoid_last_column = 1;
            }
         }
      }

The long names there are from term.h, and correspond to long terminfo names,
which you may find in the terminfo manpage (or using infocmp -L).  For
reference, these features in the chunk are documented:

     auto_left_margin            bw        bw        cub1 wraps from column 0
                                                     to last column
     auto_right_margin           am        am        Terminal has automatic 
margins
     eat_newline_glitch          xenl      xn        Newline ignored after 80 
columns
                                                     (Concept)
     enter_am_mode               smam      SA         Turn on automatic margins
     exit_am_mode                rmam      RA         Turn off automatic margins

The variable avoid_last_column is designed to fix the problem that you're
reporting.  For cygwin, it should set avoid_last_column to 1, since it
has am, and none of xenl, rmam, smam.  PuTTY has xenl (both the correct
"putty" entry, as well as "xterm" which is incorrect), so it won't enter
the if-statement.

The other relevant part is the computation for Screen_cols, which starts
with the value from the terminfo (80) and allows the $COLUMNS environment
variable to override it.  The avoid_last_column flag is checked after
this.  It is possible for $COLUMNS to be grossly inaccurate, even if it
is set to 81 it would produce the effect you are seeing.

http://cygwin.com/ml/cygwin/2005-10/msg00454.html

suggested a problem in this area, but I do not see any response to those
points.

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net

Attachment: pgp6T43tHQqLJ.pgp
Description: PGP signature

Reply via email to