Module Name:    src
Committed By:   christos
Date:           Sun Jun 30 16:29:42 UTC 2024

Modified Files:
        src/lib/libedit: common.c

Log Message:
Avoid moving the cursor before the buffer (Robert Morris)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279487


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libedit/common.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/common.c
diff -u src/lib/libedit/common.c:1.49 src/lib/libedit/common.c:1.50
--- src/lib/libedit/common.c:1.49	Mon Mar 30 02:54:37 2020
+++ src/lib/libedit/common.c	Sun Jun 30 12:29:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: common.c,v 1.49 2020/03/30 06:54:37 ryo Exp $	*/
+/*	$NetBSD: common.c,v 1.50 2024/06/30 16:29:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)common.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: common.c,v 1.49 2020/03/30 06:54:37 ryo Exp $");
+__RCSID("$NetBSD: common.c,v 1.50 2024/06/30 16:29:42 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -222,7 +222,8 @@ ed_move_to_end(EditLine *el, wint_t c __
 			return CC_REFRESH;
 		}
 #ifdef VI_MOVE
-		el->el_line.cursor--;
+		if (el->el_line.cursor > el->el_line.buffer)
+			el->el_line.cursor--;
 #endif
 	}
 	return CC_CURSOR;

Reply via email to