commit 04ae2cd51c8aca6a6a922ef3e21874d9ed8d77a5
parent ab01fec2ac5af48709dbbde844077d7e4ef5eae7
Author: hhvn <dev@hhvn.uk>
Date: Mon, 19 Sep 2022 13:07:34 +0100
Do not duplicate SELF_NEW_DAY on /grep
Diffstat:
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/commands.c b/src/commands.c
@@ -1222,7 +1222,7 @@ command_grep) {
p->rformat = emalloc(strlen(p->format) + 1);
/* since only one or zero characters are added to
* rformat for each char in format, and both are the
- * same sie, there is no need to expand rformat or
+ * same size, there is no need to expand rformat or
* truncate it. */
for (i = 0, s = p->format; s && *s; s++) {
switch (*s) {
diff --git a/src/hist.c b/src/hist.c
@@ -169,7 +169,9 @@ hist_add(struct HistInfo *histinfo,
if (strcmp(msg, "SELF_NEW_DAY") != 0 &&
histinfo && histinfo->history &&
histinfo->history->timestamp < timestamp &&
- !(histinfo->history->options & HIST_RLOG)) {
+ !(histinfo->history->options & HIST_RLOG) &&
+ !(histinfo->history->options & HIST_GREP) &&
+ !(options & HIST_GREP)) {
localtime_r(&histinfo->history->timestamp, &ptm);
localtime_r(×tamp, &ctm);
if (ptm.tm_mday != ctm.tm_mday || ptm.tm_mon != ctm.tm_mon || ptm.tm_year != ctm.tm_year) {