Dominique Pellé | 18 Mar 00:52 2012
Picon

[patch] fixed misalignments when using tabs with concealed char prior to the tab

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
(Continue reading)

Bram Moolenaar | 18 Mar 21:53 2012
Picon
Picon

Re: [patch] fixed misalignments when using tabs with concealed char prior to the tab


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.

Aligning might still be wrong when spaces are used instead of tabs, but
that is impossible to make both work with concealing enabled and
disabled.

(Continue reading)

Dominique Pellé | 19 Mar 18:49 2012
Picon

Re: [patch] fixed misalignments when using tabs with concealed char prior to the tab

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.

(Continue reading)

Dominique Pellé | 24 Mar 10:51 2012
Picon

Re: [patch] fixed misalignments when using tabs with concealed char prior to the tab

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
(Continue reading)

Christian Brabandt | 24 Mar 13:33 2012

Re: [patch] fixed misalignments when using tabs with concealed char prior to the tab

Hi Dominique!

On Sa, 24 Mär 2012, Dominique Pellé wrote:

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

This is probably the same error, I reported some time ago:
http://groups.google.com/group/vim_dev/browse_thread/thread/50b3ad720d3232b3/b36a94dd486b2287?lnk=gst&q=christian+brabandt+conceal#b36a94dd486b2287

regards,
Christian

--

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

Dominique Pellé | 24 Mar 14:53 2012
Picon

Re: [patch] fixed misalignments when using tabs with concealed char prior to the tab

Christian Brabandt wrote:

> Hi Dominique!
>
> On Sa, 24 Mär 2012, Dominique Pellé wrote:
>
>> - 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)
>
> This is probably the same error, I reported some time ago:
> http://groups.google.com/group/vim_dev/browse_thread/thread/50b3ad720d3232b3/b36a94dd486b2287?lnk=gst&q=christian+brabandt+conceal#b36a94dd486b2287
>
> regards,
> Christian

Hi Christian

Thanks for the link. Your patch (Oct 7, 2011) and my patch (Mar 18, 2012)
touch indeed the same lines of code in "screen.c".

However, your patch fixes jumping to the correct char when doing
"norm! fC" in the test case that you described, but it does not fix
the 2 issues that I described in this thread (misalignment with tabs
and search jumping to wrong locations).

The patch that I proposed in the thread fixes all issues so far:
the 2 issues  described in this thread and also the issue you found
with "norm! fC".

(Continue reading)

Bram Moolenaar | 28 Mar 14:20 2012
Picon
Picon

Re: [patch] fixed misalignments when using tabs with concealed char prior to the tab


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.
> >
(Continue reading)


Gmane