nano-devel
[Top][All Lists]
Advanced

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

[Nano-devel] NANO_SMALL confusion and a do_justify patch.


From: David Benbennick
Subject: [Nano-devel] NANO_SMALL confusion and a do_justify patch.
Date: Sun, 10 Mar 2002 07:33:32 -0500 (EST)

In the changes I made to the do_justify function of nano.c, I found
another (I think final) bug, an off-by-one error.  Below is the resulting
total patch versus nano.c, v1.248.

There are some problems with NANO_SMALL.  I don't have autoconf 2.52 yet,
so I wrote my own Makefile.  Thus, when I turned on NANO_SMALL today, I
found it requires
     DISABLE_BROWSER
     DISABLE_TABCOMP
     DISABLE_JUSTIFY
     DISABLE_SPELLER
     DISABLE_HELP
     DISABLE_MOUSE
     DISABLE_OPERATINGDIR
The point is, at the top of each .c file should be something like
     #ifdef NANO_SMALL
     #define DISABLE_BROWSER
       <etc.>
     #endif
That way people mucking around with their own makefiles won't think Nano
is broken, and also the meaning of NANO_SMALL will be more explicitly
stated.


Finally, it appears from the code that NANO_SMALL and ENABLE_MULTIBUFFER
are supposed to be compatible, yet turning them both on (and turning on
the DISABLE_s from above) makes things break.  Are they really supposed to
be compatible?  Shall I fix it and submit a diff?



--- nano/nano.c Sat Mar  9 15:05:26 2002
+++ nano-working/nano.c Sun Mar 10 04:49:16 2002
@@ -2282,7 +2282,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;
@@ -2296,16 +2296,12 @@
 /* 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) {
+     /* ARGH!  We must look at the length of the first i+1 characters. */
+                  strnlenpt(current->data,i+1) > fill) {
                 i = last_space;
                 break;
               }
@@ -2340,7 +2336,7 @@
            slen -= i + 1;
            current_y++;
        } while ((strlenpt(current->data) > (fill))
-                && !no_spaces(current->data));
+                && !no_spaces(current->data + qdepth));
     }
     tmpbot = current;




reply via email to

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