]> git.neil.brown.name Git - wiggle.git/commitdiff
Browser: Don't highlight spaces so much.
authorNeilBrown <neilb@suse.de>
Mon, 19 Aug 2013 01:15:53 +0000 (11:15 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 19 Aug 2013 01:15:53 +0000 (11:15 +1000)
Highlighting spaces is very noisy and doesn't help very much.
We only really need to differentiate spaces from tabs and highlighting
tabs is enough for that.

We continue to highlight spaces that are adjacent to tabs, but not
other spaces.

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

index 51c52a259c1fd31c8e6cdd8c9b13046d3f88fb85..5f068a96b1712acd63a3e6671670f0fabb09d277 100644 (file)
--- a/vpatch.c
+++ b/vpatch.c
@@ -966,9 +966,11 @@ static void draw_mside(int mode, int row, int offset, int start, int cols,
                highlight_space = 0;
                attr = visible(mode, m, &pos);
                if ((attr == a_unmatched || attr == a_extra) &&
-                   changed &&
-                   (*c == ' ' || *c == '\t'))
-                       highlight_space = 1;
+                   changed)
+                       /* Only highlight spaces if there is a tab nearby */
+                       for (l = 0; l < e.plen + e.prefix; l++)
+                               if (c[l] == '\t')
+                                       highlight_space = 1;
                for (l = 0; l < e.plen + e.prefix; l++) {
                        int scol = col;
                        if (*c == '\n')