Fullwidth sign characters, misaligned colorcolumn, and missing visual highlighting

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Fullwidth sign characters, misaligned colorcolumn, and missing visual highlighting

Andrew Stewart
Hello!

Under certain circumstances the colorcolumn becomes misaligned by one character:

1. A lign has a sign whose text is a fullwidth character.
2. The colorcolumn is a column after the end of the text on the line.

In those circumstances the colorcolumn is drawn at column n-1 instead of n.

Here's how to reproduce:

1. Define a sign whose text is a fullwidth character (e.g. U+FF0B fullwidth plus sign):

    :sign define foo text=+

2. Open a file in vim.

3. Place the sign somewhere:

    :sign place 1 name=foo line=5 buffer=1

4. Set the colorcolumn to a number greater than the last colum of the line with the sign:

    :set cc=20

5a. Expected: the colorcolumn is drawn at column 20.
5b. Actual: the colorcolumn is drawn at column 19.

Furthermore, the line with the sign is no longer highlighted in a visual selection.  To reproduce (following on from above):

6. Go to line 4, switch to visual line mode, and select a few lines encompassing the line with the sign:

    4GV2j

7a. Expected: lines 4-6 are highlighted.
7b. Actual: line 5 isn't.

Can anyone shed any light on all this?

Many thanks,

Andrew Stewart

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Fullwidth sign characters, misaligned colorcolumn, and missing visual highlighting

Christian Brabandt
On Di, 01 Dez 2015, [hidden email] wrote:

> Hello!
>
> Under certain circumstances the colorcolumn becomes misaligned by one character:
>
> 1. A lign has a sign whose text is a fullwidth character.
> 2. The colorcolumn is a column after the end of the text on the line.
>
> In those circumstances the colorcolumn is drawn at column n-1 instead of n.
>
> Here's how to reproduce:
>
> 1. Define a sign whose text is a fullwidth character (e.g. U+FF0B fullwidth plus sign):
>
>     :sign define foo text=+
>
> 2. Open a file in vim.
>
> 3. Place the sign somewhere:
>
>     :sign place 1 name=foo line=5 buffer=1
>
> 4. Set the colorcolumn to a number greater than the last colum of the line with the sign:
>
>     :set cc=20
>
> 5a. Expected: the colorcolumn is drawn at column 20.
> 5b. Actual: the colorcolumn is drawn at column 19.
>
> Furthermore, the line with the sign is no longer highlighted in a visual selection.  To reproduce (following on from above):
>
> 6. Go to line 4, switch to visual line mode, and select a few lines encompassing the line with the sign:
>
>     4GV2j
>
> 7a. Expected: lines 4-6 are highlighted.
> 7b. Actual: line 5 isn't.
>
> Can anyone shed any light on all this?
>
> Many thanks,

Looks like a bug to me.

Best,
Christian
--
Eine schöne Frau wäre dumm, wenn sie auch noch klug wäre.
                -- Werner Mitsch

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Fullwidth sign characters, misaligned colorcolumn, and missing visual highlighting

Christian Brabandt
In reply to this post by Andrew Stewart

On Di, 01 Dez 2015, [hidden email] wrote:

> Hello!
>
> Under certain circumstances the colorcolumn becomes misaligned by one character:
>
> 1. A lign has a sign whose text is a fullwidth character.
> 2. The colorcolumn is a column after the end of the text on the line.
>
> In those circumstances the colorcolumn is drawn at column n-1 instead of n.
>
> Here's how to reproduce:
>
> 1. Define a sign whose text is a fullwidth character (e.g. U+FF0B fullwidth plus sign):
>
>     :sign define foo text=+
>
> 2. Open a file in vim.
>
> 3. Place the sign somewhere:
>
>     :sign place 1 name=foo line=5 buffer=1
>
> 4. Set the colorcolumn to a number greater than the last colum of the line with the sign:
>
>     :set cc=20
>
> 5a. Expected: the colorcolumn is drawn at column 20.
> 5b. Actual: the colorcolumn is drawn at column 19.
>
> Furthermore, the line with the sign is no longer highlighted in a visual selection.  To reproduce (following on from above):
>
> 6. Go to line 4, switch to visual line mode, and select a few lines encompassing the line with the sign:
>
>     4GV2j
>
> 7a. Expected: lines 4-6 are highlighted.
> 7b. Actual: line 5 isn't.
>
> Can anyone shed any light on all this?
>
Attached is a patch.

I tried pretty hard to create a test using the existing facilities from
test_listlbr_utf8, since this does already some screen testing.

Unfortunately, it seems the colorcolumn isn't captured by the
screenchar() function (well i guess it is, but since this is only
highlighting, it returns a space). Then I worked around that issue using
screenattr() and while this seems to work, for some reasons it did not
fail the test with unpatched Vims.

I suspect, that the cursor movement is not working correctly, because
when I break into that test I press l twice to move from column 1 to
column 2. But then I thought, it shouldn't hurt to keep that test.

Best,
Christian
--
Bleiben wird von uns nur, was wir dem Allgemeinen geweiht.
                -- Karl Gutzkow (Vom Baum der Erkenntnis)

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

sign_issue.diff (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Fullwidth sign characters, misaligned colorcolumn, and missing visual highlighting

Bram Moolenaar

> On Di, 01 Dez 2015, [hidden email] wrote:
> > Hello!
> >
> > Under certain circumstances the colorcolumn becomes misaligned by one character:
> >
> > 1. A lign has a sign whose text is a fullwidth character.
> > 2. The colorcolumn is a column after the end of the text on the line.
> >
> > In those circumstances the colorcolumn is drawn at column n-1 instead of n.
> >
> > Here's how to reproduce:
> >
> > 1. Define a sign whose text is a fullwidth character (e.g. U+FF0B fullwidth plus sign):
> >
> >     :sign define foo text=+
> >
> > 2. Open a file in vim.
> >
> > 3. Place the sign somewhere:
> >
> >     :sign place 1 name=foo line=5 buffer=1
> >
> > 4. Set the colorcolumn to a number greater than the last colum of the line with the sign:
> >
> >     :set cc=20
> >
> > 5a. Expected: the colorcolumn is drawn at column 20.
> > 5b. Actual: the colorcolumn is drawn at column 19.
> >
> > Furthermore, the line with the sign is no longer highlighted in a visual selection.  To reproduce (following on from above):
> >
> > 6. Go to line 4, switch to visual line mode, and select a few lines encompassing the line with the sign:
> >
> >     4GV2j
> >
> > 7a. Expected: lines 4-6 are highlighted.
> > 7b. Actual: line 5 isn't.
> >
> > Can anyone shed any light on all this?
> >
>
> Attached is a patch.
>
> I tried pretty hard to create a test using the existing facilities from
> test_listlbr_utf8, since this does already some screen testing.
>
> Unfortunately, it seems the colorcolumn isn't captured by the
> screenchar() function (well i guess it is, but since this is only
> highlighting, it returns a space). Then I worked around that issue using
> screenattr() and while this seems to work, for some reasons it did not
> fail the test with unpatched Vims.
>
> I suspect, that the cursor movement is not working correctly, because
> when I break into that test I press l twice to move from column 1 to
> column 2. But then I thought, it shouldn't hurt to keep that test.

Thanks for the fix.  Not sure if we can make testing this easier.

--
hundred-and-one symptoms of being an internet addict:
172. You join listservers just for the extra e-mail.

 /// Bram Moolenaar -- [hidden email] -- 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_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Fullwidth sign characters, misaligned colorcolumn, and missing visual highlighting

Andrew Stewart
In reply to this post by Christian Brabandt
On 1 Dec 2015, at 21:31, Christian Brabandt <[hidden email]> wrote:
> Attached is a patch.


Thanks!

I applied the patch to MacVim 7.4.947 and I can confirm it solved both problems for me.

Thanks again,

Yours,
Andrew

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.