Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libedit Don't save the el->el_line.cursor over a cv_inse...



details:   https://anonhg.NetBSD.org/src/rev/19e11643504f
branches:  trunk
changeset: 583514:19e11643504f
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Aug 10 12:46:24 2005 +0000

description:
Don't save the el->el_line.cursor over a cv_insert call and use it later
because it might change. From Stefan Farfedeler.

diffstat:

 lib/libedit/vi.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (41 lines):

diff -r 52c06007a912 -r 19e11643504f lib/libedit/vi.c
--- a/lib/libedit/vi.c  Wed Aug 10 11:48:17 2005 +0000
+++ b/lib/libedit/vi.c  Wed Aug 10 12:46:24 2005 +0000
@@ -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 @@
 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 @@
 
        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);
 }
 



Home | Main Index | Thread Index | Old Index