From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 2E7686DE20B2 for ; Thu, 9 Mar 2017 07:44:48 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.503 X-Spam-Level: X-Spam-Status: No, score=0.503 tagged_above=-999 required=5 tests=[AWL=-0.149, SPF_NEUTRAL=0.652] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wHpA1jWznqxa for ; Thu, 9 Mar 2017 07:44:47 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 2C8546DE20A2 for ; Thu, 9 Mar 2017 07:44:47 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 6A7C11000DF; Thu, 9 Mar 2017 17:44:13 +0200 (EET) From: Tomi Ollila To: David Bremner , notmuch@notmuchmail.org Subject: Re: [David Bremner] Re: [PATCH] cli/new: Avoid printing "\033[K" to non-terminal output In-Reply-To: <87zigu4ky8.fsf@tethera.net> References: <87zigu4ky8.fsf@tethera.net> User-Agent: Notmuch/0.23.5+113~gfa95df1 (https://notmuchmail.org) Emacs/24.5.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Mar 2017 15:44:48 -0000 On Thu, Mar 09 2017, David Bremner wrote: > From: David Bremner > Subject: Re: [PATCH] cli/new: Avoid printing "\033[K" to non-terminal out= put > To: =C5=81ukasz Stelmach > Date: Thu, 09 Mar 2017 08:35:11 -0400 > > =C5=81ukasz Stelmach writes: > >> --- >> notmuch-new.c | 5 ++--- >> 1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/notmuch-new.c b/notmuch-new.c >> index 1321263..44174ad 100644 >> --- a/notmuch-new.c >> +++ b/notmuch-new.c >> @@ -905,10 +905,9 @@ print_results (const add_files_state_t *state) >> state->processed_files =3D=3D 1 ? "file" : "total files"); >> notmuch_time_print_formatted_seconds (elapsed); >> if (elapsed > 1) >> - printf (" (%d files/sec.).\033[K\n", >> + printf (" (%d files/sec.)", >> (int) (state->processed_files / elapsed)); >> - else >> - printf (".\033[K\n"); >> + printf(".%s\n", (state->output_is_a_tty) ? "\033[K" : ""); >> } > > Other than missing a space after printf (which I can hopefully remember > to add when I commit it, this looks fine). I looked this briefly a while ago -- there were quite a few \033[K:s that were not taken care of... would those have needed to be... For those who don't know, CSI K clears up to the end of line. > > d Tomi