summaryrefslogtreecommitdiffstats
path: root/bin/sh/histedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/histedit.c')
-rw-r--r--bin/sh/histedit.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c
index 453c9a6..2d922be 100644
--- a/bin/sh/histedit.c
+++ b/bin/sh/histedit.c
@@ -183,6 +183,7 @@ histcmd(int argc, char **argv)
struct jmploc *volatile savehandler;
char editfile[PATH_MAX];
FILE *efp;
+ int oldhistnum;
#ifdef __GNUC__
/* Avoid longjmp clobbering */
(void) &editor;
@@ -361,7 +362,15 @@ histcmd(int argc, char **argv)
* XXX what about recursive and
* relative histnums.
*/
+ oldhistnum = he.num;
history(hist, &he, H_ENTER, s);
+ /*
+ * XXX H_ENTER moves the internal
+ * cursor, set it back to the current
+ * entry.
+ */
+ retval = history(hist, &he,
+ H_NEXT_EVENT, oldhistnum);
}
} else
fputs(s, efp);
OpenPOWER on IntegriCloud