nano-devel
[Top][All Lists]
Advanced

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

[Nano-devel] A patch to the patch.


From: David Benbennick
Subject: [Nano-devel] A patch to the patch.
Date: Thu, 7 Mar 2002 14:51:01 -0500 (EST)

Hello Chris, Jordi, and everyone,

Here is a patch to the justify code changes I submitted two days ago.  I
misunderstood the meaning of the "qdepth" variable.  The result is that
justifying worked fine most times; chose a slightly wrong place sometimes;
and failed spectacularly with the line

> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > i i

[ That is, many indent strings and two i's all on one line. ]

So, attached is the new code, and below is a diff.

There are some other little bugs with justifying that I intend to fix
tomorrow, but I thought I should fix the ones I created first (grin).

David



--- nano/nano.c Thu Mar  7 13:16:40 2002
+++ nano-working/nano.c Thu Mar  7 14:36:05 2002
@@ -2343,7 +2343,7 @@
     totsize += slen;
 
     if ((strlenpt(current->data) > (fill))
-       && !no_spaces(current->data)) {
+       && !no_spaces(current->data + qdepth)) {
        do {
            int i = 0, j = 0;
            int len2 = 0;
@@ -2357,16 +2357,11 @@
 /* Note that we CAN break before the first word, since that is how 
  * pico does it. */
             int last_space = -1;  /* index of the last breakpoint */
-            int allowed_width;
 
-            i = qdepth * strlen(quotestr);  /* the line starts with 
-                      indentation, so we must skip it! */
-            allowed_width = fill - i;   /* how wide can our lines be? */
-
-            for(; i<slen; i++) {
+            for(i=qdepth; i<slen; i++) {
               if (isspace((int) current->data[i])) last_space = i;
               if (last_space!=-1 &&
-                  strnlenpt(current->data,i) >= allowed_width) {
+                  strnlenpt(current->data,i) > fill) {
                 i = last_space;
                 break;
               }
@@ -2401,7 +2396,7 @@
            slen -= i + 1;
            current_y++;
        } while ((strlenpt(current->data) > (fill))
-                && !no_spaces(current->data));
+                && !no_spaces(current->data + qdepth));
     }
     tmpbot = current;

Attachment: nano.c
Description: Text document


reply via email to

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