From b3afc5dc912589b6eee2da2a7c86c4826fdd221f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 12 Aug 2019 20:19:56 -0700 Subject: listener: don't flush lines when writing files. * linenoise/linenoise.h (struct lino_os): New virtual operation, puts_file_fn: like puts_fn, but not display-oriented: doesn't check for and ignore padding characters, and doesn't flush after each line. (lino_os_init): Initializer macro updated. * linenoise/linenoise.c (edit_it_editor): Use puts_file_fn to write to temporary file. (lino_hist_save): Likewise, when writing out history. * parser.c (lino_puts_file): New static function. (linenoise_txr_binding): Add lino_puts_file to initializer to wire in the operation. --- linenoise/linenoise.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'linenoise/linenoise.c') diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index 01b6b53d..060963c5 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -1947,7 +1947,7 @@ static void edit_in_editor(lino_t *l) { int preserve = 0; tr(l->data, '\r', '\n'); - if (lino_os.puts_fn(fo, l->data) && lino_os.puts_fn(fo, L"\n")) + if (lino_os.puts_file_fn(fo, l->data) && lino_os.puts_file_fn(fo, L"\n")) { mem_t *fi; lino_os.close_fn(fo); @@ -2745,8 +2745,8 @@ int lino_hist_save(lino_t *ls, const wchar_t *filename) { } for (j = 0; j < ls->history_len; j++) { - lino_os.puts_fn(fp, ls->history[j]); - lino_os.puts_fn(fp, L"\n"); + lino_os.puts_file_fn(fp, ls->history[j]); + lino_os.puts_file_fn(fp, L"\n"); } lino_os.close_fn(fp); -- cgit v1.2.3