fix bug where if moving in history during a multi-line event, the
append to history event would end up in the last event where the history was moved to instead of the multi-line event; reported by Mycroft
This commit is contained in:
parent
3d8b8b2ed2
commit
338ea4cec8
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: histedit.c,v 1.18 1998/04/07 10:16:04 fair Exp $ */
|
||||
/* $NetBSD: histedit.c,v 1.19 1998/05/20 00:29:26 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: histedit.c,v 1.18 1998/04/07 10:16:04 fair Exp $");
|
||||
__RCSID("$NetBSD: histedit.c,v 1.19 1998/05/20 00:29:26 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -111,7 +111,7 @@ histedit()
|
||||
el_out = fdopen(2, "w");
|
||||
if (el_in == NULL || el_out == NULL)
|
||||
goto bad;
|
||||
el = el_init(arg0, el_in, el_out);
|
||||
el = el_init(arg0, el_in, el_out, el_out);
|
||||
if (el != NULL) {
|
||||
if (hist)
|
||||
el_set(el, EL_HIST, history, hist);
|
||||
@ -159,7 +159,7 @@ sethistsize(hs)
|
||||
if (hs == NULL || *hs == '\0' ||
|
||||
(histsize = atoi(hs)) < 0)
|
||||
histsize = 100;
|
||||
history(hist, &he, H_SETMAXSIZE, histsize);
|
||||
history(hist, &he, H_SETSIZE, histsize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: input.c,v 1.29 1998/03/29 04:41:44 mrg Exp $ */
|
||||
/* $NetBSD: input.c,v 1.30 1998/05/20 00:30:20 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)input.c 8.3 (Berkeley) 6/9/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: input.c,v 1.29 1998/03/29 04:41:44 mrg Exp $");
|
||||
__RCSID("$NetBSD: input.c,v 1.30 1998/05/20 00:30:20 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -98,6 +98,9 @@ struct parsefile {
|
||||
};
|
||||
|
||||
|
||||
#ifndef SMALL
|
||||
int lastevent = 0; /* last event number */
|
||||
#endif
|
||||
int plinno = 1; /* input line number */
|
||||
MKINIT int parsenleft; /* copy of parsefile->nleft */
|
||||
MKINIT int parselleft; /* copy of parsefile->lleft */
|
||||
@ -298,8 +301,19 @@ check:
|
||||
if (parsefile->fd == 0 && hist && something) {
|
||||
HistEvent he;
|
||||
INTOFF;
|
||||
history(hist, &he,
|
||||
whichprompt == 1 ? H_ENTER : H_ADD, parsenextc);
|
||||
if (whichprompt == 1) {
|
||||
history(hist, &he, H_ENTER, parsenextc);
|
||||
lastevent = he.num;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* In case the user moved around in the history buffer,
|
||||
* we reset to the last full line event.
|
||||
*/
|
||||
if (history(hist, &he, H_SET, lastevent) == -1)
|
||||
error("History: %d: `%s'", lastevent, he.str);
|
||||
history(hist, &he, H_ADD, parsenextc);
|
||||
}
|
||||
INTON;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user