From owner-freebsd-bugs@FreeBSD.ORG Sun Jul 10 19:10:11 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BBED1065679 for ; Sun, 10 Jul 2011 19:10:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 198DE8FC1D for ; Sun, 10 Jul 2011 19:10:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p6AJAAT0029869 for ; Sun, 10 Jul 2011 19:10:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p6AJAANk029868; Sun, 10 Jul 2011 19:10:10 GMT (envelope-from gnats) Resent-Date: Sun, 10 Jul 2011 19:10:10 GMT Resent-Message-Id: <201107101910.p6AJAANk029868@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alexander Best Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 034721065673 for ; Sun, 10 Jul 2011 19:06:05 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id CE0718FC08 for ; Sun, 10 Jul 2011 19:06:04 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p6AJ646X094016 for ; Sun, 10 Jul 2011 19:06:04 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p6AJ64Tq094015; Sun, 10 Jul 2011 19:06:04 GMT (envelope-from nobody) Message-Id: <201107101906.p6AJ64Tq094015@red.freebsd.org> Date: Sun, 10 Jul 2011 19:06:04 GMT From: Alexander Best To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/158775: top(1)'s output when using 'C' and 'H' interactively is inconsistent with the other interactive keys X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2011 19:10:11 -0000 >Number: 158775 >Category: bin >Synopsis: top(1)'s output when using 'C' and 'H' interactively is inconsistent with the other interactive keys >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Jul 10 19:10:10 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Alexander Best >Release: 9.0-CURRENT >Organization: >Environment: FreeBSD otaku 9.0-CURRENT FreeBSD 9.0-CURRENT #20 r223849=be9ff60-dirty: Fri Jul 8 04:39:15 CEST 2011 arundel@otaku:/usr/obj/usr/git-freebsd-head/sys/ARUNDEL amd64 >Description: when using the interaactive key commands in top, such as 'z' or 't', the output is being displayed with an extra space before it. this is useful, because the first character is occupied by the blinking cursor and thus improves readability of the output. for the 'C' and 'H' keys however this isn't the case. no extra space is being displayed before the output and thus the first character collides with the cursors postion. the attached patch should fix the problem. please note that for interactive commands such as 'u' or 's' the situation is different. the cursor jumps to the end of the output, because the user is requested to input further information. for these messages not having an extra space at their beginning is OK. >How-To-Repeat: run 'top' and compare the output of the 'C' and 'H' command, compared to 'z' or 't' e.g. >Fix: Patch attached with submission follows: diff --git a/contrib/top/top.c b/contrib/top/top.c index 6673a27..31dd869 100644 --- a/contrib/top/top.c +++ b/contrib/top/top.c @@ -1019,7 +1020,7 @@ restart: case CMD_thrtog: ps.thread = !ps.thread; new_message(MT_standout | MT_delayed, - "Displaying threads %s", + " Displaying threads %s", ps.thread ? "separately" : "as a count"); header_text = format_header(uname_field); reset_display(); @@ -1028,7 +1029,7 @@ restart: case CMD_wcputog: ps.wcpu = !ps.wcpu; new_message(MT_standout | MT_delayed, - "Displaying %sCPU", + " Displaying %sCPU", ps.wcpu ? "W" : ""); header_text = format_header(uname_field); reset_display(); >Release-Note: >Audit-Trail: >Unformatted: