Problem with signcolum=number

28 views
Skip to first unread message

Salman Halim

unread,
Jul 1, 2019, 10:10:02 AM7/1/19
to v...@vim.org
Hello,

When setting 'signcolumn' to number, if I edit a file containing fewer than ten lines and have a plug-in that shows marks as signs (or have manually created signs), the signs are occasionally three columns wide, thus wider than the number column. This breaks editing, such as pressing x to remove a character (it removes the wrong character).

I was able to work around this by setting 'numberwidth' to a larger number, but was wondering whether this could somehow be enforced as a minimum if using signcolum set to number. 

Thank you,

--

Salman

Yegappan Lakshmanan

unread,
Jul 1, 2019, 10:33:25 AM7/1/19
to vim...@googlegroups.com, Vim
Hi,

On Mon, Jul 1, 2019 at 7:09 AM Salman Halim <salma...@gmail.com> wrote:
>
> Hello,
>
> When setting 'signcolumn' to number, if I edit a file containing fewer
> than ten lines and have a plug-in that shows marks as signs (or have
> manually created signs), the signs are occasionally three columns
> wide, thus wider than the number column. This breaks editing, such as
> pressing x to remove a character (it removes the wrong character).
>

Can you post the sign definition? When you say "occasionally", do you
know which operation or movement triggers this?

Thanks,
Yegappan

Yegappan Lakshmanan

unread,
Jul 1, 2019, 10:36:58 AM7/1/19
to vim...@googlegroups.com, Vim
Hi,

On Mon, Jul 1, 2019 at 7:33 AM Yegappan Lakshmanan <yega...@gmail.com> wrote:
>
> On Mon, Jul 1, 2019 at 7:09 AM Salman Halim <salma...@gmail.com> wrote:
> >
> > Hello,
> >
> > When setting 'signcolumn' to number, if I edit a file containing fewer
> > than ten lines and have a plug-in that shows marks as signs (or have
> > manually created signs), the signs are occasionally three columns
> > wide, thus wider than the number column. This breaks editing, such as
> > pressing x to remove a character (it removes the wrong character).
> >
>
> Can you post the sign definition? When you say "occasionally", do you
> know which operation or movement triggers this?
>

What is the 'numberwidth' option set to?

- Yegappan

Salman Halim

unread,
Jul 1, 2019, 10:57:06 AM7/1/19
to Vim Users


--

Salman

On Mon, Jul 1, 2019, 10:33 Yegappan Lakshmanan <yega...@gmail.com> wrote:
Hi,

On Mon, Jul 1, 2019 at 7:09 AM Salman Halim <salma...@gmail.com> wrote:
>
> Hello,
>
> When setting 'signcolumn' to number, if I edit a file containing fewer
> than ten lines and have a plug-in that shows marks as signs (or have
> manually created signs), the signs are occasionally three columns
> wide, thus wider than the number column. This breaks editing, such as
> pressing x to remove a character (it removes the wrong character).
>

Can you post the sign definition? When you say "occasionally", do you
know which operation or movement triggers this?

Thanks,
Yegappan

It's a trivial case.

Start with an empty file: gvim -u NONE -U NONE

(I use Windows, gvim 8.1-1608)

:set number numberwidth=1 signcolumn=number

Add the sign (named piet) in the example off :help :sign with the line changed to 1 and no file.

For me, the sign takes three columns, ">> ". Try typing on that line; the cursor should be off by one. Try hitting Escape and then hitting x. Again, off.

Hope this clarifies,

Salman

Yegappan Lakshmanan

unread,
Jul 1, 2019, 11:18:25 AM7/1/19
to vim...@googlegroups.com
Hi,

On Mon, Jul 1, 2019 at 7:57 AM Salman Halim <salma...@gmail.com> wrote:
>>
>> On Mon, Jul 1, 2019 at 7:09 AM Salman Halim <salma...@gmail.com> wrote:
>> >
>> > Hello,
>> >
>> > When setting 'signcolumn' to number, if I edit a file containing fewer
>> > than ten lines and have a plug-in that shows marks as signs (or have
>> > manually created signs), the signs are occasionally three columns
>> > wide, thus wider than the number column. This breaks editing, such as
>> > pressing x to remove a character (it removes the wrong character).
>> >
>>
>> Can you post the sign definition? When you say "occasionally", do you
>> know which operation or movement triggers this?
>>
>> Thanks,
>> Yegappan
>
>
> It's a trivial case.
> Start with an empty file: gvim -u NONE -U NONE
> (I use Windows, gvim 8.1-1608)
>
> :set number numberwidth=1 signcolumn=number
>

As the sign text takes two columns, the minimum supported value for
'numberwidth' is 3 with 'signcolumn' set to 'number'.

When 'signcolumn' is set to 'number', I think we should change the value
of 'numberwidth' to a minimum of 3 (if it is less than 3)?

- Yegappan

Salman Halim

unread,
Jul 1, 2019, 11:53:48 AM7/1/19
to Vim Users


--

Salman

On Mon, Jul 1, 2019, 11:18 Yegappan Lakshmanan <yega...@gmail.com> wrote:

> It's a trivial case.
> Start with an empty file: gvim -u NONE -U NONE
> (I use Windows, gvim 8.1-1608)
>
> :set number numberwidth=1 signcolumn=number
>

As the sign text takes two columns, the minimum supported value for
'numberwidth' is 3 with 'signcolumn' set to 'number'.

When 'signcolumn' is set to 'number', I think we should change the value
of 'numberwidth' to a minimum of 3 (if it is less than 3)?

- Yegappan

Yup. That's effectively what I suggested in my original email message. 

Salman

Bram Moolenaar

unread,
Jul 1, 2019, 2:56:46 PM7/1/19
to vim...@googlegroups.com, Yegappan Lakshmanan

Yegappan wrote:

> On Mon, Jul 1, 2019 at 7:57 AM Salman Halim <salma...@gmail.com> wrote:
> >>
> >> On Mon, Jul 1, 2019 at 7:09 AM Salman Halim <salma...@gmail.com> wrote:
> >> >
> >> > Hello,
> >> >
> >> > When setting 'signcolumn' to number, if I edit a file containing fewer
> >> > than ten lines and have a plug-in that shows marks as signs (or have
> >> > manually created signs), the signs are occasionally three columns
> >> > wide, thus wider than the number column. This breaks editing, such as
> >> > pressing x to remove a character (it removes the wrong character).
> >> >
> >>
> >> Can you post the sign definition? When you say "occasionally", do you
> >> know which operation or movement triggers this?
> >>
> >> Thanks,
> >> Yegappan
> >
> >
> > It's a trivial case.
> > Start with an empty file: gvim -u NONE -U NONE
> > (I use Windows, gvim 8.1-1608)
> >
> > :set number numberwidth=1 signcolumn=number
> >
>
> As the sign text takes two columns, the minimum supported value for
> 'numberwidth' is 3 with 'signcolumn' set to 'number'.
>
> When 'signcolumn' is set to 'number', I think we should change the value
> of 'numberwidth' to a minimum of 3 (if it is less than 3)?

Yes, can be added to number_width().
Would appreciate if you add a test.

--
You cannot propel yourself forward by patting yourself on the back.

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///

Yegappan Lakshmanan

unread,
Jul 2, 2019, 10:51:10 AM7/2/19
to Bram Moolenaar, vim...@googlegroups.com
Hi,

On Mon, Jul 1, 2019 at 11:56 AM Bram Moolenaar <Br...@moolenaar.net> wrote:
>
> Yegappan wrote:
>
> > On Mon, Jul 1, 2019 at 7:57 AM Salman Halim <salma...@gmail.com> wrote:
> > >>
> > >> On Mon, Jul 1, 2019 at 7:09 AM Salman Halim <salma...@gmail.com> wrote:
> > >> >
> > >> > Hello,
> > >> >
> > >> > When setting 'signcolumn' to number, if I edit a file containing fewer
> > >> > than ten lines and have a plug-in that shows marks as signs (or have
> > >> > manually created signs), the signs are occasionally three columns
> > >> > wide, thus wider than the number column. This breaks editing, such as
> > >> > pressing x to remove a character (it removes the wrong character).
> > >> >
> > >>
> > >> Can you post the sign definition? When you say "occasionally", do you
> > >> know which operation or movement triggers this?
> > >>
> > >> Thanks,
> > >> Yegappan
> > >
> > >
> > > It's a trivial case.
> > > Start with an empty file: gvim -u NONE -U NONE
> > > (I use Windows, gvim 8.1-1608)
> > >
> > > :set number numberwidth=1 signcolumn=number
> > >
> >
> > As the sign text takes two columns, the minimum supported value for
> > 'numberwidth' is 3 with 'signcolumn' set to 'number'.
> >
> > When 'signcolumn' is set to 'number', I think we should change the value
> > of 'numberwidth' to a minimum of 3 (if it is less than 3)?
>
> Yes, can be added to number_width().
> Would appreciate if you add a test.
>

I created PR #4606 with a fix for this issue and the tests for it.

https://github.com/vim/vim/pull/4606

- Yegappan
Reply all
Reply to author
Forward
0 new messages