Module Name:    src
Committed By:   christos
Date:           Sat Jan 21 17:12:56 UTC 2012

Modified Files:
        src/dist/nvi/common: delete.c
        src/dist/nvi/vi: getc.c

Log Message:
PR/10367: Mason Loring Bliss: fix delete word near end of file. Patch
from tnozaki.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/dist/nvi/common/delete.c
cvs rdiff -u -r1.3 -r1.4 src/dist/nvi/vi/getc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/dist/nvi/common/delete.c
diff -u src/dist/nvi/common/delete.c:1.1.1.2 src/dist/nvi/common/delete.c:1.2
--- src/dist/nvi/common/delete.c:1.1.1.2	Sun May 18 10:29:41 2008
+++ src/dist/nvi/common/delete.c	Sat Jan 21 12:12:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: delete.c,v 1.1.1.2 2008/05/18 14:29:41 aymeric Exp $ */
+/*	$NetBSD: delete.c,v 1.2 2012/01/21 17:12:56 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993, 1994
@@ -89,6 +89,11 @@ del(SCR *sp, MARK *fm, MARK *tm, int lmo
 
 	/* Case 3 -- delete within a single line. */
 	if (tm->lno == fm->lno) {
+		if (tm->cno == fm->cno) {
+			if (db_delete(sp, fm->lno))
+				return (1);
+			goto done;
+		}
 		if (db_get(sp, fm->lno, DBG_FATAL, &p, &len))
 			return (1);
 		GET_SPACE_RETW(sp, bp, blen, len);

Index: src/dist/nvi/vi/getc.c
diff -u src/dist/nvi/vi/getc.c:1.3 src/dist/nvi/vi/getc.c:1.4
--- src/dist/nvi/vi/getc.c:1.3	Mon Mar 21 10:53:04 2011
+++ src/dist/nvi/vi/getc.c	Sat Jan 21 12:12:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: getc.c,v 1.3 2011/03/21 14:53:04 tnozaki Exp $ */
+/*	$NetBSD: getc.c,v 1.4 2012/01/21 17:12:56 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993, 1994
@@ -143,10 +143,12 @@ cs_fspace(SCR *sp, VCS *csp)
 int
 cs_fblank(SCR *sp, VCS *csp)
 {
+	if (csp->cs_flags == CS_EMP)
+		return (0);
 	for (;;) {
 		if (cs_next(sp, csp))
 			return (1);
-		if (csp->cs_flags == CS_EOL || csp->cs_flags == CS_EMP ||
+		if (csp->cs_flags == CS_EOL ||
 		    (csp->cs_flags == 0 && ISBLANK2(csp->cs_ch)))
 			continue;
 		break;
@@ -212,10 +214,12 @@ cs_prev(SCR *sp, VCS *csp)
 int
 cs_bblank(SCR *sp, VCS *csp)
 {
+	if (csp->cs_flags == CS_EMP)
+		return (0);
 	for (;;) {
 		if (cs_prev(sp, csp))
 			return (1);
-		if (csp->cs_flags == CS_EOL || csp->cs_flags == CS_EMP ||
+		if (csp->cs_flags == CS_EOL ||
 		    (csp->cs_flags == 0 && ISBLANK2(csp->cs_ch)))
 			continue;
 		break;

Reply via email to