unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] cli/new: Avoid printing "\033[K" to non-terminal output
       [not found] <CGME20170302122208eucas1p2dcea0ead891ae5216a5e734a5f079db6@eucas1p2.samsung.com>
@ 2017-03-02 12:22 ` Łukasz Stelmach
       [not found]   ` <87bmta6328.fsf@tethera.net>
  2017-03-10 11:44   ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Łukasz Stelmach @ 2017-03-02 12:22 UTC (permalink / raw)
  To: notmuch; +Cc: Łukasz Stelmach

---
 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 == 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" : "");
     }
 
     if (state->added_messages)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cli/new: Avoid printing "\033[K" to non-terminal output
       [not found]   ` <87bmta6328.fsf@tethera.net>
@ 2017-03-10  9:21     ` Łukasz Stelmach
  0 siblings, 0 replies; 3+ messages in thread
From: Łukasz Stelmach @ 2017-03-10  9:21 UTC (permalink / raw)
  To: tomi.ollila; +Cc: David Bremner, notmuch

[-- Attachment #1: Type: text/plain, Size: 1323 bytes --]

Tomi Ollila wrote:
>It was <2017-03-09 czw 13:35>, when David Bremner wrote:
>> Łukasz Stelmach <l.stelmach@samsung.com> 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 == 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...

As far as I can tell this is the only one left, that is not under the
condition of output_is_a_tty (at least in notmuch-new).

-- 
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cli/new: Avoid printing "\033[K" to non-terminal output
  2017-03-02 12:22 ` [PATCH] cli/new: Avoid printing "\033[K" to non-terminal output Łukasz Stelmach
       [not found]   ` <87bmta6328.fsf@tethera.net>
@ 2017-03-10 11:44   ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2017-03-10 11:44 UTC (permalink / raw)
  To: Łukasz Stelmach, notmuch; +Cc: Łukasz Stelmach

Łukasz Stelmach <l.stelmach@samsung.com> writes:

> ---
>  notmuch-new.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

pushed with whitespace change to master,

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-10 11:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170302122208eucas1p2dcea0ead891ae5216a5e734a5f079db6@eucas1p2.samsung.com>
2017-03-02 12:22 ` [PATCH] cli/new: Avoid printing "\033[K" to non-terminal output Łukasz Stelmach
     [not found]   ` <87bmta6328.fsf@tethera.net>
2017-03-10  9:21     ` Łukasz Stelmach
2017-03-10 11:44   ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).