Source-Changes-HG archive

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

[src/trunk]: src/dist/nvi PR/10367: Mason Loring Bliss: fix delete word near ...



details:   https://anonhg.NetBSD.org/src/rev/001d33555aa5
branches:  trunk
changeset: 772916:001d33555aa5
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 21 17:12:56 2012 +0000

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

diffstat:

 dist/nvi/common/delete.c |   7 ++++++-
 dist/nvi/vi/getc.c       |  10 +++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diffs (58 lines):

diff -r e4e4d903cf60 -r 001d33555aa5 dist/nvi/common/delete.c
--- a/dist/nvi/common/delete.c  Sat Jan 21 16:51:38 2012 +0000
+++ b/dist/nvi/common/delete.c  Sat Jan 21 17:12:56 2012 +0000
@@ -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 @@
 
        /* 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);
diff -r e4e4d903cf60 -r 001d33555aa5 dist/nvi/vi/getc.c
--- a/dist/nvi/vi/getc.c        Sat Jan 21 16:51:38 2012 +0000
+++ b/dist/nvi/vi/getc.c        Sat Jan 21 17:12:56 2012 +0000
@@ -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 @@
 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 @@
 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;



Home | Main Index | Thread Index | Old Index