Menu

#19 Expand tabs broken for long tabstops

closed
nobody
2020-06-14
2018-11-30
Anonymous
No

Originally created by: fritzophrenic

Original report by Ben Fritz (Bitbucket: fritzophrenic NA, ).

The original report had attachments: lang.vim, sample.lang, sample.reported.html, sample.reproduced.html


Reported on vim_dev after introduction of vartabs support in vim8.1_v1:

https://groups.google.com/forum/#!topic/vim_dev/0nOYcdc2VBw

Probably a regression related to vartabs support added in latest release; but I have not tested with older versions to be sure.

Sample files copied from vim_dev attached, slightly modified to insert numbers to more easily see the number of spaces inserted. The first tabs in each line get expanded properly. The 2nd tabs do not get reliably expanded at all, or expand to the wrong number of spaces.

Related

Issues: #19

Discussion

  • Anonymous

    Anonymous - 2018-11-30

    Originally posted by: fritzophrenic

    Original comment by Ben Fritz (Bitbucket: fritzophrenic NA, ).


    Note: turning off syntax makes the tab expansion work correctly. So either related to having markup present, or related to the zero-width lookbehinds. This will be a good test to add once I figure out the root cause. :-)

     
  • Anonymous

    Anonymous - 2018-12-01

    Originally posted by: fritzophrenic

    Original comment by Ben Fritz (Bitbucket: fritzophrenic NA, ).


    Root cause: this is a regression caused by using s:startcol directly to calculate the tab stop position. This works when all tabs are in the same syntax ID region, because they will all be processed at the same time, sharing an s:startcol and adjusting for each tab in the loop. But after the syntax ID changes, s:startcol does not reflect the expanded tabs from the first syntax ID regions, so too short of a width is assigned to the preceding text and the wrong tab stop is used.

     
  • Anonymous

    Anonymous - 2018-12-01

    Ticket changed by: fritzophrenic

    • status: open --> closed
     
  • Anonymous

    Anonymous - 2018-12-01

    Originally posted by: fritzophrenic

    Original comment by Ben Fritz (Bitbucket: fritzophrenic NA, ).


    Fix broken tabstops coming after a syntax item with preceding tabs.

    s:startcol is set from a byte index into a line. When all tab characters in a
    line are within the same syntax item, this does not matter, because all will be
    expanded using the same s:startcol. But when they have differing syntax items,
    the s:startcol cannot be used directly for expanding tabs in a later syntax
    item, because s:startcol does not include the expanded spaces of the first tab.

    Instead, use the first virtual column occupied by a tab character to calculate
    the correct tab stop.

    Fixes [#19].

     

    Related

    Issues: #19


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.