Dominique Pellé wrote:

> > Bram Moolenaar wrote:
> >
> >> Dominique Pelle wrote:
> >>
> >>> 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.
> >>
> >> There have been various problems with conceal mode.  I'm afraid that
> >> another change might break this again.  Can you please write a test for
> >> this problem?  It should fail without the patch.
> >
> > A test would be good. Give me so time as I will be busy in the next few
> > weeks. I'm also not sure yet how it can be tested but I'll try to find out.
> >
> > Besides fixing alignment, I also found that the patch fixes another
> > problem in Vim-7.3.475. If you type...
> >
> > $ vim -u NONE -c 'set nocp hls cole=3 cocu=n|syntax on|he :index|/rint'
> >
> > ... then press  n  to jump to all matches of the searched string, observe
> > that cursor jumps to the wrong locations. With the proposed patch, cursor
> > jumps to correct locations.
> 
> 
> I'm afraid that I have not found a way to add an automated test for the
> patch.  I thought of using virtcol('.') but it gives the same results
> before & after patch: virtcol() returns the virtual column as if there
> was no concealed characters. This is by design I think: everything
> in Vim behaves as if characters were not concealed. It would be good
> to indicate it in  :help virtcol().
> 
> Perhaps someone else has ideas to be able to test the patch. If not,
> I hope that the patch can still be accepted without automated test.
> 
> I remind that it fixes two problems:
> 
> - misalignments in help page (ex: at line 1065 after ":Print...") when doing:
>   $ vim -u NONE -c 'set nocp conceallevel=3|syntax on|help :index'
> 
> - cursor at wrong position after tabs when doing:
>   $ vim -u NONE -c 'set nocp hls cole=3 cocu=n|syntax on|he :index|/rint'
>   (then press  n  to go to next matches)

Being able to test this is important enough to justify adding a function
to get the screen column.  The question is how to get it.  Perhaps
screen_cur_col best reflects the actual cursor position.  However, it is
internal in screen.c.  We don't want it to be set in another file, thus
adding a function in screen.c to get the value would be best.

The name could be screencol().  Might as well add screenrow() then.
The documentation should explain when this differs from virtcol('.').
And it should be mentioned that updating the screen position may be
postponed until a redraw.

-- 
ARTHUR: This new learning amazes me, Sir Bedevere.  Explain again how sheep's
        bladders may be employed to prevent earthquakes.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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

Raspunde prin e-mail lui