Adding an entry to the history with H_ENTER moves libedit's internal
history cursor. Reset the cursor after adding the entry to the history when doing ``fc -s'' so the output is correct.
This commit is contained in:
parent
72353893d4
commit
32c077867c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97730
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user