summaryrefslogtreecommitdiffstats
path: root/linenoise/linenoise.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-08-12 20:19:56 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-08-12 20:19:56 -0700
commitb3afc5dc912589b6eee2da2a7c86c4826fdd221f (patch)
tree2b05c2dd51419b560658272d8e1623afae7bfe61 /linenoise/linenoise.h
parent8814829f386cb8b4fd89b969f0188d26bb61440d (diff)
downloadtxr-b3afc5dc912589b6eee2da2a7c86c4826fdd221f.tar.gz
txr-b3afc5dc912589b6eee2da2a7c86c4826fdd221f.tar.bz2
txr-b3afc5dc912589b6eee2da2a7c86c4826fdd221f.zip
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.
Diffstat (limited to 'linenoise/linenoise.h')
-rw-r--r--linenoise/linenoise.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/linenoise/linenoise.h b/linenoise/linenoise.h
index 3c887a33..b43fb45f 100644
--- a/linenoise/linenoise.h
+++ b/linenoise/linenoise.h
@@ -68,6 +68,7 @@ typedef struct lino_os {
void (*free_fn)(void *);
int (*fileno_fn)(mem_t *stream);
int (*puts_fn)(mem_t *stream, const wchar_t *str);
+ int (*puts_file_fn)(mem_t *stream, const wchar_t *str);
wint_t (*getch_fn)(mem_t *stream);
wchar_t *(*getl_fn)(mem_t *stream, wchar_t *buf, size_t nchar);
wchar_t *(*gets_fn)(mem_t *stream, wchar_t *buf, size_t nchar);
@@ -80,11 +81,12 @@ typedef struct lino_os {
} lino_os_t;
#define lino_os_init(alloc, realloc, wmalloc, wrealloc, wstrdup, free, \
- fileno, puts, getch, getl, gets, eof, \
- open, open8, fdopen, close, wide_disp) \
+ fileno, puts, puts_file, getch, getl, gets, \
+ eof, open, open8, fdopen, close, wide_disp) \
{ \
alloc, realloc, wmalloc, wrealloc, wstrdup, free, \
- fileno, puts, getch, getl, gets, eof, open, open8, fdopen, close, \
+ fileno, puts, puts_file, getch, getl, gets, eof, \
+ open, open8, fdopen, close, \
wide_disp \
}