Module Name: src Committed By: christos Date: Sat Jan 21 19:32:37 UTC 2012
Modified Files: src/dist/nvi/common: cut.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/dist/nvi/common/cut.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/cut.c diff -u src/dist/nvi/common/cut.c:1.5 src/dist/nvi/common/cut.c:1.6 --- src/dist/nvi/common/cut.c:1.5 Wed Nov 23 14:25:28 2011 +++ src/dist/nvi/common/cut.c Sat Jan 21 14:32:37 2012 @@ -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 @@ copyloop: } -#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 @@ cut_line(SCR *sp, db_recno_t lno, size_t * 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;