nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] 1.3.9pre1 has a quirk with lines that are longer than t


From: David Lawrence Ramsey
Subject: Re: [Nano-devel] 1.3.9pre1 has a quirk with lines that are longer than the terminal
Date: Tue, 04 Oct 2005 00:46:49 -0400
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050716)

Mike Frysinger wrote:

<snip>

>seems theres a minor off-by-one bug in the handling of lines which
>scroll off the right side of the page, not sure when this started
>happening ... tested on amd64 against 1.3.9pre1 and the latest cvs ...

<snip>

>i noticed this while writing some code ... the thing that alerted me
>was that as i scrolled up and down in the file, the ending character
>where there should be a '$' would change to seemingly random things (i
>saw a 'G', 'A', '[', etc..., but probably related to the code i had in
>my buffer at the time).  it threw me off at first because i thought i
>typed something invalid, but after i resized my terminal i found that
>the code was fine, it was just the display that was just wonky.

Good catch.  It turns out that display_string() needs room for (COLS +
1) and not COLS characters.  With only COLS characters, the last one
ends up being garbage, hence your problem with random characters being
displayed at the ends of lines.  I believe I've fixed this in CVS, or
you can try the attached patch against 1.3.9pre1.

diff -ur nano-1.3.8-cvs/src/winio.c nano-1.3.8-cvs-fixed/src/winio.c
--- nano-1.3.8-cvs/src/winio.c  2005-09-25 22:16:53.000000000 -0400
+++ nano-1.3.8-cvs-fixed/src/winio.c    2005-10-03 23:42:03.000000000 -0400
@@ -2328,7 +2328,7 @@
     assert(column <= start_col);
 
     /* Allocate enough space for the entire line. */
-    alloc_len = (mb_cur_max() * COLS);
+    alloc_len = (mb_cur_max() * (COLS + 1));
 
     converted = charalloc(alloc_len + 1);
     index = 0;

reply via email to

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