]> git.neil.brown.name Git - wiggle.git/commitdiff
vpatch: allow a word to have text before the newline.
authorNeilBrown <neilb@suse.de>
Fri, 1 Mar 2013 08:09:35 +0000 (19:09 +1100)
committerNeilBrown <neilb@suse.de>
Fri, 1 Mar 2013 08:09:35 +0000 (19:09 +1100)
Previously we don't print out ends_line() words at all.
But soon a word might have some content plus a newline at
the end.
So restructure the display to print non-newline characters
from any word.
Note that we cannot have characters *after* a newline.
Doing that would break too much of wiggle's formating
assumptions.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch.c

index 8d41a78793f880c1f9db94574cee1c0b783f412b..5437a849f98d148e19cf44f46549b2998a4b80da 100644 (file)
--- a/vpatch.c
+++ b/vpatch.c
@@ -955,10 +955,9 @@ static void draw_mside(int mode, int row, int offset, int start, int cols,
                int highlight_space;
                int l;
                e = next_melmnt(&pos.p, fm, fb, fa, m);
-               if (e.start == NULL ||
-                   (ends_line(e)
-                    && visible(mode, m, &pos) != -1))
+               if (!e.start)
                        break;
+
                if (visible(mode, m, &pos) == -1)
                        continue;
                if (e.start[0] == 0)
@@ -972,6 +971,8 @@ static void draw_mside(int mode, int row, int offset, int start, int cols,
                        highlight_space = 1;
                for (l = 0; l < e.plen + e.prefix; l++) {
                        int scol = col;
+                       if (*c == '\n')
+                               break;
                        (void)attrset(attr);
                        if (*c >= ' ' && *c != 0x7f) {
                                if (highlight_space)
@@ -1021,6 +1022,9 @@ static void draw_mside(int mode, int row, int offset, int start, int cols,
                        }
                        c++;
                }
+               if ((ends_line(e)
+                    && visible(mode, m, &pos) != -1))
+                       break;
        }
 
        /* We have reached the end of visible line, or end of file */