summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-02-18 19:55:04 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-02-18 19:55:04 -0800
commit3434c8a937e39910d982130a88097da490304eb5 (patch)
treef81bee35ef66fbca793ab33e9326320ad39dd1cc /parser.c
parent843347592f7b4143f8a11ef29ff8c633489ee3c3 (diff)
downloadtxr-3434c8a937e39910d982130a88097da490304eb5.tar.gz
txr-3434c8a937e39910d982130a88097da490304eb5.tar.bz2
txr-3434c8a937e39910d982130a88097da490304eb5.zip
listener: if no new lines, don't save history.
* linenoise/linenoise.c (lino_have_new_lines): New function. * linenoise/linenoise.h (lino_have_new_lines): Declared. * parser.c (hist_save): Do nothing if lino_have_new_lines returns false.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/parser.c b/parser.c
index bcdb0005..4da0b150 100644
--- a/parser.c
+++ b/parser.c
@@ -1330,7 +1330,7 @@ static void hist_save(lino_t *ls, val in_stream, val out_stream,
val histfile, const wchar_t *histfile_w,
val hist_len_var)
{
- if (histfile_w) {
+ if (histfile_w && lino_have_new_lines(ls)) {
val histfile_tmp = format(nil, lit("~a.tmp"), histfile, nao);
const wchar_t *histfile_tmp_w = c_str(histfile_tmp);
lino_t *ltmp = lino_make(coerce(mem_t *, in_stream),