From 4aa917455c1a90bd515f346971c7be950d0426e8 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Mon, 25 Mar 2013 00:00:00 -0500 Subject: [PATCH] top: fix the bug affecting certain Find/Locate results When 'Other Filtering' was introduced the idea of what constituted a displayed row changed. No longer was any call to task_show assured of consuming one screen row. Now the determining factor was whether or not the rows were empty. This worked Ok until a certain Find string was active then the entire display could be corrupted. With Find active, the task_show() function alters each returned row while highlighting each visible match. If the search was on a single byte value & matched at the beginning of a row the match got overwritten with '\0' which then appears empty upon return to window_show(). So that row would not be counted as having been shown. This was best illustrated with a Find on a single ' '. This patch will restore proper 'Find/Locate' behavior. Reference(s): commit 5edc6fb3174f1fd02bbfca61ec6d8a3a2e12f71c Signed-off-by: Jim Warner --- top/top.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/top/top.c b/top/top.c index 9e88ea50..15300d82 100644 --- a/top/top.c +++ b/top/top.c @@ -5192,6 +5192,8 @@ static const char *task_show (const WIN_t *q, const proc_t *p) { ofs = find_ofs(q, row); } while (-1 < ofs); PUTT("%s%s", row, Caps_endline); + // with a corrupted rbuf, ensure row is 'counted' by window_show + rbuf[0] = '!'; } else PUFF("\n%s%s%s", cap, row, Caps_endline); } -- 2.40.0