[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] Fixes for 1.3.11
From: |
David Lawrence Ramsey |
Subject: |
Re: [Nano-devel] Fixes for 1.3.11 |
Date: |
Thu, 18 May 2006 13:55:41 -0400 |
User-agent: |
Thunderbird 1.5.0.2 (X11/20060420) |
David Lawrence Ramsey wrote:
<snip>
> Three patches in particular. (Thanks in advance.)
Make that four, given the just-reported wrapping problem. The bug is in
break_line(), and has apparently been in nano since break_line() was
overhauled to handle multibyte characters. The attached
nano1311wrapfix.patch will fix this.
diff -ur nano-1.3.11/src/text.c nano-1.3.11-fixed/src/text.c
--- nano-1.3.11/src/text.c 2006-02-18 16:32:29.000000000 -0500
+++ nano-1.3.11-fixed/src/text.c 2006-05-18 13:51:50.000000000 -0400
@@ -607,14 +607,14 @@
* found with short enough display width. */
ssize_t cur_loc = 0;
/* Current index in line. */
+ size_t cur_pos = 0;
+ /* Current column position in line. */
int line_len;
assert(line != NULL);
- while (*line != '\0' && goal >= 0) {
- size_t pos = 0;
-
- line_len = parse_mbchar(line, NULL, &pos);
+ while (*line != '\0' && goal >= cur_pos) {
+ line_len = parse_mbchar(line, NULL, &cur_pos);
if (is_blank_mbchar(line)
#ifndef DISABLE_HELP
@@ -629,12 +629,11 @@
#endif
}
- goal -= pos;
line += line_len;
cur_loc += line_len;
}
- if (goal >= 0)
+ if (goal >= cur_pos)
/* In fact, the whole line displays shorter than goal. */
return cur_loc;