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

[PATCH] Scrollbind when scrolling unfocussed window

Expand Messages
  • Jonathon Mah
    Hi all, This is my first patch here, and my first time working on Vim s source, so I could do with a bit of guidance. With this patch, I ve tried to hack my
    Message 1 of 10 , Jan 10 9:50 AM
      Hi all,

      This is my first patch here, and my first time working on Vim's
      source, so I could do with a bit of guidance.

      With this patch, I've tried to hack my way through getting scrollbind
      to work when scrolling unfocussed windows (the one not containing the
      cursor). This was annoying me, because when I had a vert split diff
      open, my mouse wheel wouldn't scroll both windows in sync half the
      time (when my mouse cursor was over the inactive pane). I just did
      some superficial testing, and it seemed to work, but I don't know the
      nuances of scrollbind.

      I generated this patch against r1318 from the SourceForge SVN repo.




      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Markus Heidelberg
      ... This is intended behaviour and explicitly mentioned in the second paragraph of :help scroll-binding . It can be useful and your patch doesn t allow it
      Message 2 of 10 , Jan 10 6:19 PM
        Jonathon Mah, 10.01.2009:
        > With this patch, I've tried to hack my way through getting scrollbind
        > to work when scrolling unfocussed windows (the one not containing the
        > cursor). This was annoying me, because when I had a vert split diff
        > open, my mouse wheel wouldn't scroll both windows in sync half the
        > time (when my mouse cursor was over the inactive pane).

        This is intended behaviour and explicitly mentioned in the second
        paragraph of ":help scroll-binding". It can be useful and your patch
        doesn't allow it anymore.

        Try ":set mousefocus", it should give you what you want.

        Markus



        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • hamlen
        I ve been meaning to request a patch that does exactly what Jonathon s patch does except only when a specific option appears in scrollopt . This would be
        Message 3 of 10 , Jan 10 7:24 PM
          I've been meaning to request a patch that does exactly what Jonathon's
          patch does except only when a specific option appears in "scrollopt".
          This would be extremely useful since, although the intended behavior
          is sometimes useful, it is in other cases extremely confusing and
          impossible to fully disable. Could Jonathon's patch be adapted to
          this purpose? That is, would it be possible to change it so that
          executing ":set scrollopt+=unfocused" causes all scroll-bound windows
          to stay in sync regardless of mouse focus, and ":set scrollopt-
          =unfocused" restores the default behavior? If so, think this would be
          a very valuable addition.

          Kevin

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_dev" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Tony Mechelynck
          ... The fact that scrolling the unfocused window doesn t move the other one is intentional; it s meant to allow you to put the windows back into sync if, for
          Message 4 of 10 , Jan 10 10:58 PM
            On 10/01/09 18:50, Jonathon Mah wrote:
            > Hi all,
            >
            > This is my first patch here, and my first time working on Vim's
            > source, so I could do with a bit of guidance.
            >
            > With this patch, I've tried to hack my way through getting scrollbind
            > to work when scrolling unfocussed windows (the one not containing the
            > cursor). This was annoying me, because when I had a vert split diff
            > open, my mouse wheel wouldn't scroll both windows in sync half the
            > time (when my mouse cursor was over the inactive pane). I just did
            > some superficial testing, and it seemed to work, but I don't know the
            > nuances of scrollbind.
            >
            > I generated this patch against r1318 from the SourceForge SVN repo.

            The fact that scrolling the unfocused window doesn't move the other one
            is intentional; it's meant to allow you to put the windows back into
            sync if, for any reason, they move out of sync. It's documented as the
            second paragraph under ":help scroll-binding", as follows:

            > When using the scrollbars, the binding only happens when scrolling the window
            > with focus (where the cursor is). You can use this to avoid scroll-binding
            > for a moment without resetting options.

            Best regards,
            Tony.
            --
            Travel important today; Internal Revenue men arrive tomorrow.

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_dev" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Jonathon Mah
            ... Here s a version that does that (as well as significantly cleaning up the code). I did the reverse, adding the focusonly word to scrollopt . This is on
            Message 5 of 10 , Jan 11 8:02 AM
              On 2009-01-11, at 13:54, hamlen wrote:

              > I've been meaning to request a patch that does exactly what Jonathon's
              > patch does except only when a specific option appears in "scrollopt".


              Here's a version that does that (as well as significantly cleaning up
              the code). I did the reverse, adding the 'focusonly' word to
              'scrollopt'. This is on by default, and causes Vim to act as before.
              Removing it ensures scrollbind is in effect for all windows, not just
              the focused one.

              This patch is completely rewritten, with very little in common with
              the previous one. Again, some review is much needed. I didn't adjust
              the documentation; is it customary for me to do that, or to have Bram
              do it?


              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_dev" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Nico Weber
              ... That s your job. Nico --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_dev maillist. For more information,
              Message 6 of 10 , Jan 11 8:59 AM
                > This patch is completely rewritten, with very little in common with
                > the previous one. Again, some review is much needed. I didn't adjust
                > the documentation; is it customary for me to do that, or to have Bram
                > do it?

                That's your job.

                Nico

                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_dev" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • Jonathon Mah
                ... OK, once more with feeling. Sincere apologies for the noobness. --~--~---------~--~----~------------~-------~--~----~ You received this message from the
                Message 7 of 10 , Jan 11 11:40 AM
                  On 2009-01-12, at 03:29, Nico Weber wrote:

                  >> This patch is completely rewritten, with very little in common with
                  >> the previous one. Again, some review is much needed. I didn't adjust
                  >> the documentation; is it customary for me to do that, or to have Bram
                  >> do it?
                  >
                  > That's your job.


                  OK, once more with feeling. Sincere apologies for the noobness.


                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_dev" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                • hamlen
                  ... This sounds great, Jonathon. Thanks for your work on this! --Kevin --~--~---------~--~----~------------~-------~--~----~ You received this message from
                  Message 8 of 10 , Jan 12 7:18 AM
                    > Here's a version that does that (as well as significantly cleaning up  
                    > the code). I did the reverse, adding the 'focusonly' word to  
                    > 'scrollopt'. This is on by default, and causes Vim to act as before.  
                    > Removing it ensures scrollbind is in effect for all windows, not just  
                    > the focused one.

                    This sounds great, Jonathon. Thanks for your work on this!

                    --Kevin


                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_dev" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---
                  • Bram Moolenaar
                    ... The patch adds focusonly to the scrollopt option by default. That means people who previously did something like :set scrollopt=ver will get
                    Message 9 of 10 , Feb 4, 2009
                      Jonathon Mah wrote:

                      > On 2009-01-12, at 03:29, Nico Weber wrote:
                      >
                      > >> This patch is completely rewritten, with very little in common with
                      > >> the previous one. Again, some review is much needed. I didn't adjust
                      > >> the documentation; is it customary for me to do that, or to have Bram
                      > >> do it?
                      > >
                      > > That's your job.
                      >
                      > OK, once more with feeling. Sincere apologies for the noobness.

                      The patch adds "focusonly" to the 'scrollopt' option by default. That
                      means people who previously did something like ":set scrollopt=ver"
                      will get different behavior. I think we can avoid that.

                      Isn't there another name to use, so that we can leave the default value
                      as it was? Perhaps "always" or "unfocused".

                      You removed the use of old_topline and old_topfill. How can you
                      guarantee that without the new flag things work just like before?

                      You change "curwin" without changing "curbuf", that probably won't work
                      properly.

                      You add a call to do_check_scrollbind() in edit.c without checking that
                      it's not the current window that is being scrolled. Same in normal.c.

                      Looks like this patch needs a bit more work!

                      --
                      Don't read everything you believe.

                      /// 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
                      -~----------~----~----~----~------~----~------~--~---
                    • Jonathon Mah
                      Bram, Thanks for taking a look at the patch. ... Indeed it does. I don t have a good grasp of the things scrollbind can affect (particularly its interactions
                      Message 10 of 10 , Feb 7, 2009
                        Bram,

                        Thanks for taking a look at the patch.

                        On 2009-02-05, at 03:13, Bram Moolenaar wrote:

                        > You removed the use of old_topline and old_topfill. How can you
                        > guarantee that without the new flag things work just like before?
                        >
                        > You change "curwin" without changing "curbuf", that probably won't
                        > work
                        > properly.
                        >
                        > You add a call to do_check_scrollbind() in edit.c without checking
                        > that
                        > it's not the current window that is being scrolled. Same in normal.c.
                        >
                        > Looks like this patch needs a bit more work!


                        Indeed it does. I don't have a good grasp of the things scrollbind can
                        affect (particularly its interactions with diff display), and I've
                        been hoping someone with more familiarity could point me in that
                        direction.

                        (On 2009-01-11, I wrote:)

                        > This is my first patch here, and my first time working on Vim's
                        > source, so I could do with a bit of guidance.

                        Any takers? Otherwise, could someone point me to some documentation on
                        how it all works? Spelunking isn't particularly appealing, so it's my
                        last option.



                        Jonathon Mah
                        me@...



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