Module Name: src Committed By: christos Date: Tue Nov 12 20:59:46 UTC 2019
Modified Files: src/lib/libedit: terminal.c Log Message: PR/54654: Soren Tempel: Make sure el_cursor.v < el_terminal.t_size.v when moving around. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/lib/libedit/terminal.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libedit/terminal.c diff -u src/lib/libedit/terminal.c:1.40 src/lib/libedit/terminal.c:1.41 --- src/lib/libedit/terminal.c:1.40 Sun Sep 15 17:09:11 2019 +++ src/lib/libedit/terminal.c Tue Nov 12 15:59:46 2019 @@ -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 @@ terminal_move_to_line(EditLine *el, int 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 @@ terminal_overwrite(EditLine *el, const w 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 */