Actually I've got them the wrong way round here, but others have already
explained them anyway :-).



On Wed, Jun 03, 2020 at 05:04:43PM +0100, Nicholas Marriott wrote:
> xenl (xm) only matters for the last line - you can't write into the very
> bottom right position without causing the terminal to scroll. No xenl is
> a pain and most applications solve it by just leaving that position
> always empty. The only terminal still about without xenl that I am aware
> of is the NetBSD console.
> 
> am only matters if you care where the cursor is after you write to the
> last character - that is, if you want to rely on it moving to the next
> line automatically. You can still write at the rightmost cursor
> position, just don't rely on the cursor moving to the next line or the
> terminal scrolling when you do. I expect top doesn't need to worry about
> this.
> 
> You could probably just use the full width except for the last line and
> trim the last line by 1 if tgetflag("xm") is true.
> 
> Or doesn't ncurses take care of all this anyway? Maybe it doesn't...
> 
> 
> On Wed, Jun 03, 2020 at 02:49:48PM +0200, Klemens Nanni wrote:
> > On Wed, Jun 03, 2020 at 12:45:35PM +0100, Stuart Henderson wrote:
> > > It should check terminal capabilities for this, see termcap(5).
> > > If 'am' (auto-margin) is set then it shouldn't write to the final column.
> > > If 'xn' is set then it's OK in some circumstances (it's probably easier to
> > > skip writing to the final column if this is set too).
> > Thanks mark and Stuart, I did not know about auto-margin (or autoWrap as
> > xterm(1) seems to call it).
> > 
> > What I understand is that writing to the screen's last terminal should
> > be avoided in terminal without the "am" capability, presumably because
> > it would cause a line wrap - is that correct?
> > 
> > Preliminary testing however indicates to me that at least xterm(1)
> > behaves the same in top's interactive screen with my patch, regardless
> > of the auto-margin capablility.
> > 
> > According to termcap(5) I did the following to disable "am", with
> > tput(1) I verify that it gets indeed disabled:
> > 
> >     $  echo $TERM ; tput am ; echo $?
> >     xterm
> >     0
> >     $ TERM=vt100-nam ; tput am ; echo $?
> >     1
> > 
> > But in both cases, starting ./obj/top in the very same terminal/shell
> > behaves the same, that is to say the last column is written properly and
> > I see no line wrap or any change of behaviour.
> > 

Reply via email to