vile
[Top][All Lists]
Advanced

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

Re: [vile] Here is the file which demonstrates the insert bug


From: Thomas Dickey
Subject: Re: [vile] Here is the file which demonstrates the insert bug
Date: Wed, 23 Apr 2008 16:00:44 -0400 (EDT)

On Wed, 23 Apr 2008, Chris G wrote:

That should help, I hope.  I'll go and look at the code myself but,
being unfamiliar with it, I don't promise anything exciting/useful.

I see the problem - reproducing these is the hard part.
(about an hour to narrow down the traces so I could see the error).

Here's a fix:

diff -u -r1.86 word.c
--- word.c      2008/01/22 00:13:57     1.86
+++ word.c      2008/04/23 19:52:53
@@ -42,13 +42,15 @@
        LINE *lp = DOT.l;
        to_delete = 0L;
        if (DOT.o >= 0 && !n && !isSpace(lgetc(lp, DOT.o))) {
+           int tmp = 0;
            for (c = DOT.o; c >= 0; c -= BytesBefore(DOT.l, c)) {
                if (isSpace(lgetc(lp, c))) {
                    to_append = n;
-                   cnt = (DOT.o - c);
+                   cnt = tmp;
                    DOT.o = c;
                    break;
                }
+               ++tmp;
            }
        }
        for (c = DOT.o; c >= 0; c -= BytesBefore(DOT.l, c)) {

The problem was that 'cnt' is supposed to be a character count rather than
a byte-count, but it was computed there as a byte-count.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]