diff -up procps-3.2.7/top.h.p7 procps-3.2.7/top.h --- procps-3.2.7/top.h.p7 2006-06-25 08:41:48.000000000 +0200 +++ procps-3.2.7/top.h 2008-09-01 11:29:15.000000000 +0200 @@ -149,8 +149,13 @@ do { int _len = 1 + snprintf(_str, sizeof(_str), fmt, ## arg); \ if (Batch) _ptr = _str; \ else { \ - _ptr = &Pseudo_scrn[Pseudo_row++ * Pseudo_cols]; \ - if (memcmp(_ptr, _str, _len)) { \ + int _rest; \ + _ptr = &Pseudo_scrn[Pseudo_row * Pseudo_cols]; \ + _rest = Pseudo_size-(_ptr-Pseudo_scrn); \ + Pseudo_row = (Pseudo_row+1) % Screen_rows; \ + if (_rest < _len) \ + _len = _rest; \ + if (memcmp(_ptr, _str, _len)) { \ memcpy(_ptr, _str, _len); \ } else { \ _ptr = "\n"; \