From: NeilBrown Date: Mon, 19 Aug 2013 01:15:53 +0000 (+1000) Subject: Browser: Don't highlight spaces so much. X-Git-Tag: v1.0~41 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=a4a492d78a96a1e33258beeaebbac2b48fb734ff;p=wiggle.git Browser: Don't highlight spaces so much. 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 --- diff --git a/vpatch.c b/vpatch.c index 51c52a2..5f068a9 100644 --- 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')