<<< Date Index >>>     <<< Thread Index >>>

pager bug: infinite wrapping



I've found a very minor bug.


Summary:

The builtin pager tries to wrap a line for ever
if:

0) the line contains a space or a tab character
 followed by a very long word, and
1) M_PAGER_NSKIP flag is passed to it, and
2) $smart_wrap is set. (default)


Impact:

Currently M_PAGER_NSKIP is used only by the help.
And the help limits the length of words. So, this
bug hardly appears. But Japanese sentences often
have a long line with no space (because Japanese
language doesn't use space as word-separater).
Possibly Asian users with narrow screens often see
this bug.


How to reproduce:

0) Press '?'.
1) Narrow your window width.
2) You'll see lines with only a '+' character.
3) The status bar will keep displaying "10%" (value
 varies) even if you press PageDown key again and
 again.


Patch:

Attached to this message.

-- 
tamo
--- pager.c.BAK Wed Mar 30 16:21:04 2005
+++ pager.c     Wed Mar 30 16:25:29 2005
@@ -1346,7 +1346,11 @@
        /* skip trailing blanks */
        while (ch && (buf[ch] == ' ' || buf[ch] == '\t' || buf[ch] == '\r'))
          ch--;
-       cnt = ch + 1;
+       /* a very long word with leading spaces causes infinite wrapping */
+       if ((!ch) && (flags & M_PAGER_NSKIP))
+         buf_ptr = buf + cnt;
+       else
+         cnt = ch + 1;
       }
       else
        buf_ptr = buf + cnt; /* a very long word... */