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

Unexpected setpos() behaviour

Expand Messages
  • glts
    Hi Requesting comments on unexpected setpos() behaviour; possibly a bug. Consider this buffer: First line example text Second line, tab character in front
    Message 1 of 3 , Dec 5, 2012
    • 0 Attachment
      Hi

      Requesting comments on unexpected setpos() behaviour; possibly a bug.
      Consider this buffer:

      First line example text
      Second line, tab character in front

      Steps to reproduce:
      * Put the cursor on the "t" of the word "First"
      * Place the cursor on virtual column 8 of line 2 with setpos():
      :call setpos('.', [0, 2, 1, 7])
      * Press k to move back up one line

      As you can see, the cursor lands back on the "t" of "First". This is
      unexpected: It should either land on the "i" of "line", or on the "F" of
      first, depending on whether the offset 7 in setpos() is taken into
      account.

      Note that it doesn't matter whether 'virtualedit' is set to "all" or
      not.

      glts

      --
      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
    • Bram Moolenaar
      ... This is documented: This does not restore the preferred column for moving vertically. See |winrestview()| for that. -- A meeting is an event at which the
      Message 2 of 3 , Dec 5, 2012
      • 0 Attachment
        glts wrote:

        > Requesting comments on unexpected setpos() behaviour; possibly a bug.
        > Consider this buffer:
        >
        > First line example text
        > Second line, tab character in front
        >
        > Steps to reproduce:
        > * Put the cursor on the "t" of the word "First"
        > * Place the cursor on virtual column 8 of line 2 with setpos():
        > :call setpos('.', [0, 2, 1, 7])
        > * Press k to move back up one line
        >
        > As you can see, the cursor lands back on the "t" of "First". This is
        > unexpected: It should either land on the "i" of "line", or on the "F" of
        > first, depending on whether the offset 7 in setpos() is taken into
        > account.
        >
        > Note that it doesn't matter whether 'virtualedit' is set to "all" or
        > not.

        This is documented:

        This does not restore the preferred column for moving
        vertically. See |winrestview()| for that.

        --
        A meeting is an event at which the minutes are kept and the hours are lost.

        /// 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
      • glts
        ... Oh right, sorry. Then setpos() can t be used to reliably set the cursor to some new position in mappings or commands? Well then. Thanks! glts -- You
        Message 3 of 3 , Dec 5, 2012
        • 0 Attachment
          On Wednesday, December 5, 2012 6:10:01 PM UTC+1, Bram Moolenaar wrote:
          > This is documented:
          >
          > This does not restore the preferred column for moving
          > vertically. See |winrestview()| for that.

          Oh right, sorry.

          Then setpos() can't be used to reliably set the cursor to some new
          position in mappings or commands? Well then. Thanks!

          glts

          --
          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.