jed-users mailing list

[2003 Date Index] [2003 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

bug: wrapping not wrapable line


Hi,

I have some trouble with wrapping. A line like this

  tilHere,allSpacesAreIndention.IfThisModeIndentsAfterWrappingYouHaveAnAnnoyingBehavior

is warpped. But if WRAP_INDENTS is set, this line is indented again and
is warpable again. The only thing you see, your line jumps downward.

This patch sets the first possible wrap position to the first nonblank
character after line start (this might a bug again, because not all
leading blanks must be for indention) and checks before wrapping, if it's
meaningful to wrap.

#v+
--- jed-0.99.16/src/text.c	2002-10-20 08:55:31.000000000 +0200
+++ /home/Sources/jed-0.99.16/src/text.c	2003-10-04 15:58:58.000000000 +0200
@@ -76,7 +76,13 @@
    unsigned char *p, *pmin;
    int col;
 
-   if (format) pmin = text_format_line(); else pmin = CLine->data;
+   if (format) pmin = text_format_line();
+   else {
+      /* Matches pmin == NULL the end of CLine->data?
+         maybe use isblank(*pmin) */
+      for(pmin = CLine->data; pmin != NULL && (*pmin == ' '|| *pmin == '\t');
+	  ++pmin);
+   }
    if (pmin == NULL)
      return -1;
 
@@ -116,11 +122,13 @@
 
 /*}}}*/
 
-void wrap_line(int format) /*{{{*/
+int wrap_line(int format) /*{{{*/
 {
+    int ret;
     push_spot();
-    (void) wrap_line1(format);
+    ret = wrap_line1(format);
     pop_spot();
+    return ret;
 }
 
 /*}}}*/
--- jed-0.99.16/src/text.h	2002-10-20 08:55:31.000000000 +0200
+++ /home/Sources/jed-0.99.16/src/text.h	2003-10-04 15:58:31.000000000 +0200
@@ -4,7 +4,7 @@
  * You may distribute this file under the terms the GNU General Public
  * License.  See the file COPYING for more information.
  */
-extern void wrap_line(int);
+extern int wrap_line(int);
 extern int forward_paragraph(void);
 extern void set_paragraph_separator (char *);
 extern int backward_paragraph(void);
--- jed-0.99.16/src/cmds.c	2002-10-20 08:55:31.000000000 +0200
+++ /home/Sources/jed-0.99.16/src/cmds.c	2003-10-04 15:53:19.000000000 +0200
@@ -565,7 +565,8 @@
 	    && (-1 == jed_ins (ch)))
 	  return -1;
 
-	wrap_line(0);			/* do not format--- just wrap */
+	if ( wrap_line(0) ) 	         /* do not format--- just wrap */
+	  return -1;                     /* line isn't wrapable */
 	
 	/* There is a bug involving wrapping a very long line containing
 	 * no whitespace and then we try to insert a character.  This work
#v-

Jörg.

-- 
Damit das Mögliche entsteht, muß immer wieder das Unmögliche versucht
werden.                                       (Hermann Hesse)

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2003 date index] [2003 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]