Hi

The conceal feature is messing up alignment when using tabs.

For example, content of ":help :index" looks misaligned and ugly
with ":set conceallevel=3" but looks well aligned with ":set conceallevel=0"
as shows in these 2 screenshots:

http://dominique.pelle.free.fr/pic/help_conceallevel=0.png (good)
http://dominique.pelle.free.fr/pic/help_conceallevel=3.png (bad)

You can reproduce the misaligned help page with:

$ vim -u NONE -c 'set nocp conceallevel=3|syntax on|help :index'

Attached patch fixes it. Patch extends length of tabs to compensate
for concealed chars before the tab on the line, so that text after the
tab is always aligned in the same way regardless of 'conceallevel'.
Note that this means that a tab can be longer than 'tabstop' to
compensate previous concealed chars.

Regards
-- Dominique

-- 
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
diff -r 74686ae0b181 src/screen.c
--- a/src/screen.c	Fri Mar 16 20:16:46 2012 +0100
+++ b/src/screen.c	Sun Mar 18 00:45:25 2012 +0100
@@ -4258,7 +4258,19 @@
 		{
 		    /* tab amount depends on current column */
 		    n_extra = (int)wp->w_buffer->b_p_ts
-				   - VCOL_HLC % (int)wp->w_buffer->b_p_ts - 1;
+					- vcol % (int)wp->w_buffer->b_p_ts - 1;
+#ifdef FEAT_CONCEAL
+		    /* Tab alignment should be identical regardless of 'conceallevel'
+		     * value. So tab compensates of all previous concealed characters,
+		     * and thus resets vcol_off and boguscols accumulated so far in the
+		     * line. Note that the tab can be longer than 'tabstop' when there
+		     * are concealed characters. */
+		    n_extra += vcol_off;
+		    vcol -= vcol_off;
+		    vcol_off = 0;
+		    col -= boguscols;
+		    boguscols = 0;
+#endif
 #ifdef FEAT_MBYTE
 		    mb_utf8 = FALSE;	/* don't draw as UTF-8 */
 #endif

Raspunde prin e-mail lui