Looks like I managed to fix this (not completely, see below).

The idea is that part of win_line() starting from line

else if (wp->w_p_cole > 0 && is_concealing)

and including that "voodoo" code for wrapped lines increments value of
vcol_off. Doing that for vcol_off but not fot vcol is ok for lines content,
but is not ok for cuc and colorcolumn: they must keep same positions if
they are at the wrapped part of line, i.e. increment of vcol_off must be
compensated by same increment of vcol. This is what the new patch does. It
adds a new flag is_wrapping which is set when is_concealing and
wp->w_p_wrap and a new variable vcol_adj_wrap for compensation of vcol when
wrapped part of a line is going to be printed. This compensation is added
in the macro VCOL_HLC.

This works perfectly when there is one line break: all positions of
colorcolumn and cuc are correct when cursor is being moved around. But when
I tested this for lines with multiple wrapping breaks I found that the
positions *may* still fail: I do not know why at the moment - the code of
win_line() is very huge to quickly find the reason.

Cheers, Alexey.

P.S. Not regarding to the issue. Looks like content of showbreaks are
counted as columns too: this make both printing column number at status
line and positioning of colorcolumn wrong (in my opinion), though it was
probably done by design (strange nevertheless).


2015-07-05 19:49 GMT+03:00 Bram Moolenaar <[email protected]>:

>
> Alexey Radkov wrote:
>
> > Here is a little patch that fixes broken visualization of cursorcolumn
> and
> > colorcolumn when there are many wrapped concealed lines. The idea is to
> > enable special voodoo code in win_line() at l. 5437 only for current row.
> > Conceal offsets on other lines may differ so this voodoo magic being
> > applied to them shifts positions of cursorcolumn and colorcolumn relative
> > to the current line where the cursor is positioned. This may look ugly.
> >
> > I attached two images that show broken columns before the patch applied
> and
> > good looking columns after the patch. The focus is at the right window
> on a
> > dot sign after wrapped Russian word "теплее".
>
> So, it makes it a bit better in this situation. I wonder what happens in
> other situations...
>
> --
> hundred-and-one symptoms of being an internet addict:
> 179. You wonder why your household garbage can doesn't have an
>      "empty recycle bin" button.
>
>  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net
>  \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/
> \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org
> ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org
> ///
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff -r bfc3682510d6 src/screen.c
--- a/src/screen.c	Sat Jul 04 15:05:14 2015 +0200
+++ b/src/screen.c	Tue Jul 07 14:42:39 2015 +0300
@@ -3043,12 +3043,15 @@
     int		prev_syntax_id	= 0;
     int		conceal_attr	= hl_attr(HLF_CONCEAL);
     int		is_concealing	= FALSE;
+    int		is_wrapping	= FALSE;
     int		boguscols	= 0;	/* nonexistent columns added to force
 					   wrapping */
     int		vcol_off	= 0;	/* offset for concealed characters */
+    int		vcol_adj_wrap	= 0;	/* adjustment for wrapped cuc and
+					   colorcolum */
     int		did_wcol	= FALSE;
     int		old_boguscols   = 0;
-# define VCOL_HLC (vcol - vcol_off)
+# define VCOL_HLC (vcol - vcol_off + vcol_adj_wrap)
 # define FIX_FOR_BOGUSCOLS \
     { \
 	n_extra += vcol_off; \
@@ -5449,6 +5452,7 @@
 		 * we are building, 'boguscols' keeps track of the number
 		 * of bad columns we have advanced.
 		 */
+		is_wrapping = TRUE;
 		if (n_extra > 0)
 		{
 		    vcol += n_extra;
@@ -5559,6 +5563,9 @@
 	    SCREEN_LINE(screen_row, W_WINCOL(wp), col - boguscols,
 						(int)W_WIDTH(wp), wp->w_p_rl);
 	    boguscols = 0;
+	    if (is_wrapping)
+		vcol_adj_wrap += vcol_off;
+	    is_wrapping = FALSE;
 #else
 	    SCREEN_LINE(screen_row, W_WINCOL(wp), col,
 						(int)W_WIDTH(wp), wp->w_p_rl);

Raspunde prin e-mail lui