Loading ...
Sorry, an error occurred while loading the content.

48069Re: Bug in win_lbr_chartabsize()?

Expand Messages
  • Matthew Winn
    Oct 1 1:05 AM
    • 0 Attachment
      On Mon, 01 Oct 2007 11:39:47 +1000, Ben Schmidt
      <mail_ben_schmidt@...> wrote:

      > > I've been digging through the Vim source and had trouble trying to
      > > understand what win_lbr_chartabsize() is doing. About 112 lines from
      > > the start of the function (in 7.1.94) there's a part that should take
      > > the width of a tab into account when used in combination with
      > > "showbreak". I couldn't work out how these parts were supposed to
      > > interact from studying the code so I tried studying Vim's behaviour
      > > instead. The results are a bit odd.
      > >
      > > Create a file with a line containing a repeating pattern of four
      > > letters and a tab (that is, "abcd<tab>abcd<tab>abcd<tab>...") to a
      > > width of about 300 columns. Then set wrap, showbreak=>>> and tabstop
      > > to something like 9 so there aren't a even number of tabs in your
      > > screen width or your screen width less the width of the showbreak.
      > >
      > > Now, starting from the beginning of the line, press w repeatedly
      > > and watch where the cursor goes after each movement. On some of the
      > > wrapped lines I see it settle three characters to the left of where it
      > > should be when it moves to the first word on each wrapped screen line.
      > > I've tried to fix it, but no matter what I change the cursor always
      > > lands in the wrong place at some point. Does anyone else see this?
      > I see it. There is definitely something wrong here. I doubt it's just in that one
      > function you mention, though.

      I don't think there's anywhere else where tabs and showbreak interact
      in that way. There are other character size functions but I think they
      all treat the line as if it were unbroken.

      I was inspired to look at this by the thread on non-uniform tabstops
      a month ago, as that's something I'd often find useful and I'm out of
      work at the moment so I have some free time. Different column widths
      for tabs isn't all that hard to implement (in that it melts only half
      your brain instead of all of it), but this one place didn't seem to
      make sense.

      > With 'linebreak' on the results are also impressive, though not always so
      > impressive--after a few lines wrapping does not occur properly, but words are
      > broken, and when moving through them with 'w' in some circumstances at the
      > beginning of a line the cursor stops 'between' words!

      I noticed that too, but I couldn't reproduce it reliably.

      > In both cases the cursor won't actually move to the end of the logical line
      > either, i.e. push $ and the cursor will be put near, but not at the end!

      I didn't notice that. I didn't try $.

      > Is there a reason for not making the tabs work properly on wrapped lines with
      > showbreak? Is it too difficult to implement? I would've expected all the tabstops
      > and everything else to be pushed backward by the 'showbreak' string as well.

      That's what I'd have expected.

      > If I have some time, I'll have a look at this, but don't expect I will for at
      > least a week!

      I'm going to be looking at it too. It's bugging me, not knowing what's
      going on.

      Matthew Winn

      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 4 messages in this topic