Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit PR/54654: Soren Tempel: Make sure el_cursor.v < ...



details:   https://anonhg.NetBSD.org/src/rev/a8f3253fa1f3
branches:  trunk
changeset: 1004748:a8f3253fa1f3
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Nov 12 20:59:46 2019 +0000

description:
PR/54654: Soren Tempel: Make sure el_cursor.v < el_terminal.t_size.v when
moving around.

diffstat:

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

diffs (37 lines):

diff -r 99659929b2c8 -r a8f3253fa1f3 lib/libedit/terminal.c
--- a/lib/libedit/terminal.c    Tue Nov 12 19:44:46 2019 +0000
+++ b/lib/libedit/terminal.c    Tue Nov 12 20:59:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: terminal.c,v 1.40 2019/09/15 21:09:11 christos Exp $   */
+/*     $NetBSD: terminal.c,v 1.41 2019/11/12 20:59:46 christos Exp $   */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)term.c     8.2 (Berkeley) 4/30/95";
 #else
-__RCSID("$NetBSD: terminal.c,v 1.40 2019/09/15 21:09:11 christos Exp $");
+__RCSID("$NetBSD: terminal.c,v 1.41 2019/11/12 20:59:46 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -497,7 +497,7 @@
        if (where == el->el_cursor.v)
                return;
 
-       if (where > el->el_terminal.t_size.v) {
+       if (where >= el->el_terminal.t_size.v) {
 #ifdef DEBUG_SCREEN
                (void) fprintf(el->el_errfile,
                    "%s: where is ridiculous: %d\r\n", __func__, where);
@@ -647,7 +647,8 @@
        if (el->el_cursor.h >= el->el_terminal.t_size.h) {      /* wrap? */
                if (EL_HAS_AUTO_MARGINS) {      /* yes */
                        el->el_cursor.h = 0;
-                       el->el_cursor.v++;
+                       if (el->el_cursor.v + 1 < el->el_terminal.t_size.v)
+                               el->el_cursor.v++;
                        if (EL_HAS_MAGIC_MARGINS) {
                                /* force the wrap to avoid the "magic"
                                 * situation */



Home | Main Index | Thread Index | Old Index