Don't save the el->el_line.cursor over a cv_insert call and use it later

because it might change. From Stefan Farfedeler.
This commit is contained in:
christos 2005-08-10 12:46:24 +00:00
parent 8974f21b75
commit 55ca57f0a2
1 changed files with 4 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vi.c,v 1.23 2005/08/09 16:40:12 christos Exp $ */
/* $NetBSD: vi.c,v 1.24 2005/08/10 12:46:24 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)vi.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: vi.c,v 1.23 2005/08/09 16:40:12 christos Exp $");
__RCSID("$NetBSD: vi.c,v 1.24 2005/08/10 12:46:24 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -91,7 +91,6 @@ cv_action(EditLine *el, int c)
private el_action_t
cv_paste(EditLine *el, int c)
{
char *ptr;
c_kill_t *k = &el->el_chared.c_kill;
int len = k->last - k->buf;
@ -105,12 +104,12 @@ cv_paste(EditLine *el, int c)
if (!c && el->el_line.cursor < el->el_line.lastchar)
el->el_line.cursor++;
ptr = el->el_line.cursor;
c_insert(el, len);
if (el->el_line.cursor + len > el->el_line.lastchar)
return (CC_ERROR);
(void) memcpy(ptr, k->buf, len +0u);
(void) memcpy(el->el_line.cursor, k->buf, len +0u);
return (CC_REFRESH);
}