summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/hist.c10
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 16ce32b54..ca290ea2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2023-06-08 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+ * 51826: Src/hist.c: correctly handle metafied null character
+ when reading history file
+
* Stephane: 51817: Completion/BSD/Command/_rcctl: protect ':'
in _rcctl (was in 51817 but missed in commit 0577daf)
diff --git a/Src/hist.c b/Src/hist.c
index b4dc53d90..bfbcd6ede 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -3803,8 +3803,14 @@ histsplitwords(char *lineptr, short **wordsp, int *nwordsp, int *nwordposp,
zrealloc(words, nwords*sizeof(*words));
}
words[nwordpos++] = lineptr - start;
- while (*lineptr && !inblank(*lineptr))
- lineptr++;
+ while (*lineptr) {
+ if (*lineptr == Meta && lineptr[1])
+ lineptr += 2;
+ else if (!inblank(*lineptr))
+ lineptr++;
+ else
+ break;
+ }
words[nwordpos++] = lineptr - start;
}
} while (*lineptr);