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.