The attached patch fixes the incorrect highlighting of the current column
(with 'cuc' set) and the visual blocks in changed/added lines in diff
mode. Such bad behaviour can be observed if the view of the diffed
buffer gets shifted to the right (e.g. with zl) so that the
changed/added line is shorter than the shift offset.

Examples of the described behaviour are depicted in the following screen
shots:
- visual block:
http://llorens.visualserver.org/wrong-cuc-highlight/visual-wrong.png
- current column:
http://llorens.visualserver.org/wrong-cuc-highlight/cuc-wrong.png

While the screen shots should show:
- visual block:
http://llorens.visualserver.org/wrong-cuc-highlight/visual-ok.png
- current column:
http://llorens.visualserver.org/wrong-cuc-highlight/cuc-ok.png

To reproduce the problem invoke vim with the following command line
arguments:
- visual block:
  $ vim -u NONE -c 'normal iabcdefghijklmnopqrstuvwxyz'         \
                -c 'normal yyp'                                 \
                -c 'belowright vert new | normal 2pggddp'       \
                -c 'windo diffthis | normal gg9|5zl 2j2l'

- current column:
  $ vim -u NONE -c 'normal iabcdefghijklmnopqrstuvwxyz'         \
                -c 'normal yyp'                                 \
                -c 'belowright vert new | normal 2pggddp'       \
                -c 'windo diffthis | normal gg9|5zl'            \
                -c 'set cuc'

-- 
Cheers,
Lech

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

diff --git a/src/screen.c b/src/screen.c
index 28fe238..33b13a9 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -3008,11 +3008,29 @@ win_line(wp, lnum, startrow, endrow, nochange)
 	    mb_ptr_adv(ptr);
 	}
 
+#if defined(FEAT_SYN_HL) || defined(FEAT_VIRTUALEDIT) || defined(FEAT_VISUAL)
+	/* When:
+	 * - 'cuc' is set,
+	 * - 'virtualedit' is set,
+	 * - the visual mode is active,
+	 * the end of the line may be before the start of the displayed
+	 * part.
+	 */
+	if (vcol < v &&
+	    (
+#ifdef FEAT_SYN_HL
+	     wp->w_p_cuc ||
+#endif
 #ifdef FEAT_VIRTUALEDIT
-	/* When 'virtualedit' is set the end of the line may be before the
-	 * start of the displayed part. */
-	if (vcol < v && *ptr == NUL && virtual_active())
+	     virtual_active() ||
+#endif
+#ifdef FEAT_VISUAL
+	     (VIsual_active && wp->w_buffer == curwin->w_buffer) ||
+#endif
+	     0))
+	{
 	    vcol = v;
+	}
 #endif
 
 	/* Handle a character that's not completely on the screen: Put ptr at

Raspunde prin e-mail lui