Current-Users archive

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

Re: Buglet in vi



On 27 January 2012 14:19, Chavdar Ivanov <ci4ic4%gmail.com@localhost> wrote:
> Hi,
>
> There seems to be some probably off-by-one buglet in vi lately - I
> have it on both amd64 and i386. The ex 'co' command is copying empty
> lines (move works).
>
> Posting here in case I have done something on my build systems (which
> is unlikely, as I use three separate machines with slightly different
> setups).


To answer my own mail, the following fixes it (obviously):
--- dist/nvi/ex/ex_move.c.ORIG       2008-05-18 15:31:16.000000000 +0100
+++ dist/nvi/ex/ex_move.c       2012-01-27 14:34:59.000000000 +0000
@@ -25,6 +25,7 @@
 #include <string.h>

 #include "../common/common.h"
+#define ENTIRE_LINE     (size_t)-1

 /*
  * ex_copy -- :[line [,line]] co[py] line [flags]
@@ -54,7 +55,7 @@
        memset(&cb, 0, sizeof(cb));
        CIRCLEQ_INIT(&cb.textq);
        for (cnt = fm1.lno; cnt <= fm2.lno; ++cnt)
-               if (cut_line(sp, cnt, 0, 0, &cb)) {
+               if (cut_line(sp, cnt, 0, ENTIRE_LINE, &cb)) {
                        rval = 1;
                        goto err;
                }


I'll file a PR.

>
> Chavdar Ivanov
>
> --
> ----



-- 
----


Home | Main Index | Thread Index | Old Index