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

Cursor is not moved immediately when it is moved to other window at once.

Expand Messages
  • Yukihiro Nakadaira
    Cursor is not moved immediately when it is moved to other window at once. Steps to reproduce: $ vim -u NONE ... moved. ... -- Yukihiro Nakadaira -
    Message 1 of 8 , Jun 14, 2014
    • 0 Attachment
      Cursor is not moved immediately when it is moved to other window at once.

      Steps to reproduce:
        $ vim -u NONE
        :call setline(1, range(100))
        :split
        :call cursor(50, 1) | wincmd w        " On first window, cursor is not moved.
        :wincmd w                             " Cursor is moved.

      --
      Yukihiro Nakadaira - yukihiro.nakadaira@...

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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • Christian Brabandt
      Hi Yukihiro! ... This patch should fix it: diff -r 6e8b6a7f7bff src/eval.c ... +++ b/src/eval.c Sat Jun 14 15:02:24 2014 +0200 @@ -9882,6 +9882,7 @@
      Message 2 of 8 , Jun 14, 2014
      • 0 Attachment
        Hi Yukihiro!

        On Sa, 14 Jun 2014, Yukihiro Nakadaira wrote:

        > Cursor is not moved immediately when it is moved to other window at once.
        >
        > Steps to reproduce:
        > $ vim -u NONE
        > :call setline(1, range(100))
        > :split
        > :call cursor(50, 1) | wincmd w " On first window, cursor is not
        > moved.
        > :wincmd w " Cursor is moved.
        >

        This patch should fix it:

        diff -r 6e8b6a7f7bff src/eval.c
        --- a/src/eval.c Sat Jun 14 12:53:33 2014 +0200
        +++ b/src/eval.c Sat Jun 14 15:02:24 2014 +0200
        @@ -9882,6 +9882,7 @@
        #endif

        curwin->w_set_curswant = TRUE;
        + setcursor();
        rettv->vval.v_number = 0;
        }


        Best,
        Christian
        --
        Stilblüten aus Polizeiberichten und Gerichtsverhandlungen:
        In der Nacht vom 24. auf den 25.6.75 entwendete ein unbekannter Täter
        von meinem Grundstück zwei Hühner, von denen eins ein Hahn war.

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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • Bram Moolenaar
        ... Thanks! -- Eight Megabytes And Continually Swapping. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net /// sponsor Vim,
        Message 3 of 8 , Jun 14, 2014
        • 0 Attachment
          Christian wrote:

          > Hi Yukihiro!
          >
          > On Sa, 14 Jun 2014, Yukihiro Nakadaira wrote:
          >
          > > Cursor is not moved immediately when it is moved to other window at once.
          > >
          > > Steps to reproduce:
          > > $ vim -u NONE
          > > :call setline(1, range(100))
          > > :split
          > > :call cursor(50, 1) | wincmd w " On first window, cursor is not
          > > moved.
          > > :wincmd w " Cursor is moved.
          > >
          >
          > This patch should fix it:
          >
          > diff -r 6e8b6a7f7bff src/eval.c
          > --- a/src/eval.c Sat Jun 14 12:53:33 2014 +0200
          > +++ b/src/eval.c Sat Jun 14 15:02:24 2014 +0200
          > @@ -9882,6 +9882,7 @@
          > #endif
          >
          > curwin->w_set_curswant = TRUE;
          > + setcursor();
          > rettv->vval.v_number = 0;
          > }

          Thanks!

          --
          Eight Megabytes And Continually Swapping.

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

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • Yukihiro Nakadaira
          On Sat, Jun 14, 2014 at 10:03 PM, Christian Brabandt ... Thank you. But it doesn t work for me. And this problem is not only for
          Message 4 of 8 , Jun 14, 2014
          • 0 Attachment
            On Sat, Jun 14, 2014 at 10:03 PM, Christian Brabandt <cblists@...> wrote:
            Hi Yukihiro!

            On Sa, 14 Jun 2014, Yukihiro Nakadaira wrote:

            > Cursor is not moved immediately when it is moved to other window at once.
            >
            > Steps to reproduce:
            >   $ vim -u NONE
            >   :call setline(1, range(100))
            >   :split
            >   :call cursor(50, 1) | wincmd w        " On first window, cursor is not
            > moved.
            >   :wincmd w                             " Cursor is moved.
            >

            This patch should fix it:

            diff -r 6e8b6a7f7bff src/eval.c
            --- a/src/eval.c        Sat Jun 14 12:53:33 2014 +0200
            +++ b/src/eval.c        Sat Jun 14 15:02:24 2014 +0200
            @@ -9882,6 +9882,7 @@
             #endif

                 curwin->w_set_curswant = TRUE;
            +    setcursor();
                 rettv->vval.v_number = 0;
             }

            Thank you.  But it doesn't work for me.  And this problem is not only
            for cursor().  It is same with setpos() and :123.

            --
            Yukihiro Nakadaira - yukihiro.nakadaira@...

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

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • Christian Brabandt
            ... Yeah, looks like, this was the wrong solution. Note sure, why it seemed to work for me (now I can t make it work any longer). How about, this patch, which
            Message 5 of 8 , Jun 15, 2014
            • 0 Attachment
              On Sa, 14 Jun 2014, Yukihiro Nakadaira wrote:

              > On Sat, Jun 14, 2014 at 10:03 PM, Christian Brabandt <cblists@...>
              > wrote:
              >
              > > Hi Yukihiro!
              > >
              > > On Sa, 14 Jun 2014, Yukihiro Nakadaira wrote:
              > >
              > > > Cursor is not moved immediately when it is moved to other window at once.
              > > >
              > > > Steps to reproduce:
              > > > $ vim -u NONE
              > > > :call setline(1, range(100))
              > > > :split
              > > > :call cursor(50, 1) | wincmd w " On first window, cursor is not
              > > > moved.
              > > > :wincmd w " Cursor is moved.
              > > >
              > >
              > > This patch should fix it:
              > >
              > > diff -r 6e8b6a7f7bff src/eval.c
              > > --- a/src/eval.c Sat Jun 14 12:53:33 2014 +0200
              > > +++ b/src/eval.c Sat Jun 14 15:02:24 2014 +0200
              > > @@ -9882,6 +9882,7 @@
              > > #endif
              > >
              > > curwin->w_set_curswant = TRUE;
              > > + setcursor();
              > > rettv->vval.v_number = 0;
              > > }
              > >
              >
              > Thank you. But it doesn't work for me. And this problem is not only
              > for cursor(). It is same with setpos() and :123.

              Yeah, looks like, this was the wrong solution. Note sure, why it seemed
              to work for me (now I can't make it work any longer). How about, this
              patch, which should redraw the old window, if the cursor position
              changed (thus it should redraw for all your problems mentioned) just
              before switching windows.

              diff --git a/src/window.c b/src/window.c
              --- a/src/window.c
              +++ b/src/window.c
              @@ -4250,6 +4250,9 @@ win_enter_ext(wp, undo_sync, curwin_inva
              /* sync undo before leaving the current buffer */
              if (undo_sync && curbuf != wp->w_buffer)
              u_sync(FALSE);
              + /* might need to redraw old window before switching (so cursor position
              + * will be shown correctly on the old window) */
              + update_topline();
              /* may have to copy the buffer options when 'cpo' contains 'S' */
              if (wp->w_buffer != curbuf)
              buf_copy_options(wp->w_buffer, BCO_ENTER | BCO_NOHELP);


              Best,
              Christian
              --
              Nur der Oberflächliche kennt sich selbst.
              -- Oscar Wilde

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

              ---
              You received this message because you are subscribed to the Google Groups "vim_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.
            • Yukihiro Nakadaira
              On Sun, Jun 15, 2014 at 9:16 PM, Christian Brabandt ... Maybe we also need to call do_check_scrollbind() and do_check_cursorbind() for
              Message 6 of 8 , Jun 15, 2014
              • 0 Attachment
                On Sun, Jun 15, 2014 at 9:16 PM, Christian Brabandt <cblists@...> wrote:
                On Sa, 14 Jun 2014, Yukihiro Nakadaira wrote:

                > On Sat, Jun 14, 2014 at 10:03 PM, Christian Brabandt <cblists@...>
                > wrote:
                >
                > > Hi Yukihiro!
                > >
                > > On Sa, 14 Jun 2014, Yukihiro Nakadaira wrote:
                > >
                > > > Cursor is not moved immediately when it is moved to other window at once.
                > > >
                > > > Steps to reproduce:
                > > >   $ vim -u NONE
                > > >   :call setline(1, range(100))
                > > >   :split
                > > >   :call cursor(50, 1) | wincmd w        " On first window, cursor is not
                > > > moved.
                > > >   :wincmd w                             " Cursor is moved.
                > > >
                > >
                > > This patch should fix it:
                > >
                > > diff -r 6e8b6a7f7bff src/eval.c
                > > --- a/src/eval.c        Sat Jun 14 12:53:33 2014 +0200
                > > +++ b/src/eval.c        Sat Jun 14 15:02:24 2014 +0200
                > > @@ -9882,6 +9882,7 @@
                > >  #endif
                > >
                > >      curwin->w_set_curswant = TRUE;
                > > +    setcursor();
                > >      rettv->vval.v_number = 0;
                > >  }
                > >
                >
                > Thank you.  But it doesn't work for me.  And this problem is not only
                > for cursor().  It is same with setpos() and :123.

                Yeah, looks like, this was the wrong solution. Note sure, why it seemed
                to work for me (now I can't make it work any longer). How about, this
                patch, which should redraw the old window, if the cursor position
                changed (thus it should redraw for all your problems mentioned) just
                before switching windows.

                diff --git a/src/window.c b/src/window.c
                --- a/src/window.c
                +++ b/src/window.c
                @@ -4250,6 +4250,9 @@ win_enter_ext(wp, undo_sync, curwin_inva
                     /* sync undo before leaving the current buffer */
                     if (undo_sync && curbuf != wp->w_buffer)
                        u_sync(FALSE);
                +    /* might need to redraw old window before switching (so cursor position
                +     * will be shown correctly on the old window) */
                +    update_topline();
                     /* may have to copy the buffer options when 'cpo' contains 'S' */
                     if (wp->w_buffer != curbuf)
                        buf_copy_options(wp->w_buffer, BCO_ENTER | BCO_NOHELP);

                Maybe we also need to call do_check_scrollbind() and
                do_check_cursorbind() for 'scrollbind' and 'cursorbind' option?

                --
                Yukihiro Nakadaira - yukihiro.nakadaira@...

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

                ---
                You received this message because you are subscribed to the Google Groups "vim_dev" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                For more options, visit https://groups.google.com/d/optout.
              • Christian Brabandt
                Hi Yukihiro! ... What makes you think, we need those function calls? Is there also a problem with scrollbinding? Best, Christian -- Warum sollte man einem
                Message 7 of 8 , Jun 15, 2014
                • 0 Attachment
                  Hi Yukihiro!

                  On So, 15 Jun 2014, Yukihiro Nakadaira wrote:

                  > Maybe we also need to call do_check_scrollbind() and
                  > do_check_cursorbind() for 'scrollbind' and 'cursorbind' option?

                  What makes you think, we need those function calls? Is there also a
                  problem with scrollbinding?

                  Best,
                  Christian
                  --
                  Warum sollte man einem Liebhaber treuer sein als einem Ehemann?
                  -- Jean Jacques Rousseau

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

                  ---
                  You received this message because you are subscribed to the Google Groups "vim_dev" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                  For more options, visit https://groups.google.com/d/optout.
                • Yukihiro Nakadaira
                  On Mon, Jun 16, 2014 at 3:42 AM, Christian Brabandt ... Yes. scrollbind and cursorbind also doesn t work. $ vim -u NONE ... Then,
                  Message 8 of 8 , Jun 15, 2014
                  • 0 Attachment
                    On Mon, Jun 16, 2014 at 3:42 AM, Christian Brabandt <cblists@...> wrote:
                    Hi Yukihiro!

                    On So, 15 Jun 2014, Yukihiro Nakadaira wrote:

                    > Maybe we also need to call do_check_scrollbind() and
                    > do_check_cursorbind() for 'scrollbind' and 'cursorbind' option?

                    What makes you think, we need those function calls? Is there also a
                    problem with scrollbinding?

                    Yes.  'scrollbind' and 'cursorbind' also doesn't work.

                    $ vim -u NONE
                    :set scrollbind   " or :set cursorbind
                    :call setline(1, range(100))
                    :split
                    :call cursor(50, 1) | wincmd w

                    Then, second window is not scrolled.
                    I expect that two window show same lines.

                    --
                    Yukihiro Nakadaira - yukihiro.nakadaira@...

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

                    ---
                    You received this message because you are subscribed to the Google Groups "vim_dev" group.
                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                    For more options, visit https://groups.google.com/d/optout.
                  Your message has been successfully submitted and would be delivered to recipients shortly.