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

Re: Problem with CursorMoved events: x position isn't maintained

Expand Messages
  • Bram Moolenaar
    ... You can use winsaveview() and winrestview(). -- hundred-and-one symptoms of being an internet addict: 140. You d rather catch a score on the web than watch
    Message 1 of 5 , Aug 3, 2009
    • 0 Attachment
      Tom wrote:

      > > > > xxxxxxxxxxFxxxxxxxxxxxxxxxExx
      > > > > yyyyyyyyyyD
      > > > > zzzzzzzzzzzzzzzzzzzzzzzzzzCzzzzz
      >
      > > The problem is caused by setting the 'lazyredraw' option, it causes the
      > > cursor column to be computed.
      >
      > This leads to a related question. Given the cursor is at position D,
      > is there a way to determine that the "target column" is 27 and not 11?
      > I.e. is there a way to temporarily move the cursor someplace else and
      > to return to position D without breaking cursor movement?
      >
      > I often use something like this
      >
      > let p = getpos('.')
      > ...
      > call setpos('.', p)
      >
      > If the cursor is at position D, this will set the column to 11 and the
      > cursor will move to position F when pressing k. Is there a way to make
      > it move to position E?

      You can use winsaveview() and winrestview().

      --
      hundred-and-one symptoms of being an internet addict:
      140. You'd rather catch a score on the web than watch the game as
      it is being played on tv.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ download, build and distribute -- http://www.A-A-P.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Tony Mechelynck
      On 29/07/09 10:19, Bram Moolenaar wrote: [...] ... ambiwidth maybe? Ah no, that s a string option. Ah yes: rightleft , and also arabic which sets it as a
      Message 2 of 5 , Aug 12, 2009
      • 0 Attachment
        On 29/07/09 10:19, Bram Moolenaar wrote:
        [...]
        > The problem is caused by setting the 'lazyredraw' option, it causes the
        > cursor column to be computed. Even though that is not needed. It's
        > actually done for all boolean options. The comment says it's for when
        > the 'list' option is changed, which makes sense. Any other boolean
        > option that changes the cursor column on the screen?
        >

        'ambiwidth' maybe? Ah no, that's a string option.

        Ah yes: 'rightleft', and also 'arabic' which sets it as a side-effect
        'arabicshape' when after composing characters or laam-alif pairs

        not sure about 'compatible', it has so many side effects

        'foldenable' maybe, and 'diff' if folding happens as a result (because
        when on a closed fold, the cursor is always shown in column 1)

        'wrap' and 'linebreak'

        you already mentioned 'list'

        'number'

        'scrollbind' maybe? No, I think it may move the text about relative to
        the window but not change on which character the cursor sits?

        not sure about 'termbidi'


        I may have missed a few.
        Best regards,
        Tony.
        --
        Q: How many DEC repairmen does it take to fix a flat ?
        A: Five; four to hold the car up and one to swap tires.

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      Your message has been successfully submitted and would be delivered to recipients shortly.