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

Re: [BUG] virtcol returns invalid value if virtualedit is active

Expand Messages
  • Bram Moolenaar
    ... The docs go on to say that virtualedit changes what happens: When virtualedit is used {expr} can be [lnum, col, off], where off is the offset in
    Message 1 of 2 , Jun 25, 2011
    • 0 Attachment
      ZyX wrote:

      > Consider the following script:
      > vim -u NONE -c 'set ve=all | call setline(".", ["\t"])' \
      > -c 'echo virtcol([1, 1])'
      > If you run it you will see 1 on the screen, while expected value is 8.
      > According to the help
      > > The result is a Number, which is the screen column of the file
      > > position given with {expr}. That is, the last screen position
      > > occupied by the character at that position, when the screen
      > > would be of unlimited width.
      > Setting virtualedit does not alter screen width of character and
      > nothing in the further text says that 've' affects virtcol output for
      > [line, col] expr.

      The docs go on to say that 'virtualedit' changes what happens:

      When 'virtualedit' is used {expr} can be [lnum, col, off], where
      "off" is the offset in screen columns from the start of the
      character. E.g., a position within a <Tab> or after the last
      character. When "off" is omitted zero is used.

      I added the last sentence to make clear what happens in your situation.

      hundred-and-one symptoms of being an internet addict:
      219. Your spouse has his or her lawyer deliver the divorce papers...
      via e-mail.

      /// Bram Moolenaar -- Bram@... -- 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_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
    Your message has been successfully submitted and would be delivered to recipients shortly.