Source-Changes-HG archive

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

[src/trunk]: src/dist/nvi/common PR/10367:



details:   https://anonhg.NetBSD.org/src/rev/1fdf7669c261
branches:  trunk
changeset: 772922:1fdf7669c261
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 21 19:32:37 2012 +0000

description:
PR/10367:

Restore lost fix:
    http://mail-index.netbsd.org/source-changes/2001/09/09/0042.html

Define ENTIRE_LINE to be -1 instead of 0 since we may want to copy 0 characters.
(and use ENTIRE_LINE instead of 0 where appropriate)

This fixes a bug in the dw command with for example:

<cursor>
a b c

~
~
if you hit dw there, only the empty line would be killed but both the empty
line and the subsequent one would be pasted when asked for with P for example.

diffstat:

 dist/nvi/common/cut.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 5a33ea5b005a -r 1fdf7669c261 dist/nvi/common/cut.c
--- a/dist/nvi/common/cut.c     Sat Jan 21 19:29:41 2012 +0000
+++ b/dist/nvi/common/cut.c     Sat Jan 21 19:32:37 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cut.c,v 1.5 2011/11/23 19:25:28 tnozaki Exp $ */
+/*     $NetBSD: cut.c,v 1.6 2012/01/21 19:32:37 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993, 1994
@@ -134,16 +134,16 @@
        }
 
 
-#define        ENTIRE_LINE     0
+#define        ENTIRE_LINE     -1
        /* In line mode, it's pretty easy, just cut the lines. */
        if (LF_ISSET(CUT_LINEMODE)) {
                cbp->flags |= CB_LMODE;
                for (lno = fm->lno; lno <= tm->lno; ++lno)
-                       if (cut_line(sp, lno, 0, 0, cbp))
+                       if (cut_line(sp, lno, 0, ENTIRE_LINE, cbp))
                                goto cut_line_err;
        } else {
                /*
-                * Get the first line.  A length of 0 causes cut_line
+                * Get the first line.  A length of ENTIRE_LINE causes cut_line
                 * to cut from the MARK to the end of the line.
                 */
                if (cut_line(sp, fm->lno, fm->cno, fm->lno != tm->lno ?
@@ -257,7 +257,7 @@
         * copy the portion we want, and reset the TEXT length.
         */
        if (len != 0) {
-               if (clen == 0)
+               if (clen == ENTIRE_LINE)
                        clen = len - fcno;
                MEMCPYW(tp->lb, p + fcno, clen);
                tp->len = clen;



Home | Main Index | Thread Index | Old Index