From 76c16fb9d6995695a9de05fc9e69435d6e51d3ab Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 1 Mar 2013 19:09:35 +1100 Subject: [PATCH] vpatch: allow a word to have text before the newline. 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 --- vpatch.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vpatch.c b/vpatch.c index 8d41a78..5437a84 100644 --- 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 */ -- 2.39.5