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

Re: winrestview bug on mac?

Expand Messages
  • björn
    ... Well, usually I avoid modifying the Vim source code so I was a bit surprised to see this and could not remember why I made this change. All I can come up
    Message 1 of 4 , Jul 13 5:30 AM
    • 0 Attachment
      On Sat, Jul 13, 2013 at 2:03 PM, yeer kunth wrote:
      Hi, all.

      I found a strange issue happens on Mac, not sure it's a bug or not.


      Say I map a shortcut to TestEcho function, they looks like these in the .vimrc file.

      nmap <C-@>f :echo TestEcho()<CR>

      function! TestEcho()
              let v = winsaveview()
              try
                      return "foobar"
              finally
                      call winrestview(v)
              endtry
      endfunction


      Then I open a vim, and trigger the shortcut, I can see "foobar" in the status line.
      However when I use MacVim, the status line shows nothing.


      In my expectation, the MacVim should act as what vim does. So I checkout the latest source code, and found this line of code makes the difference.

      https://github.com/b4winckler/macvim/blob/master/src/window.c#L5807

      Anyone knows the reason of this magic?
       
      Well, usually I avoid modifying the Vim source code so I was a bit surprised to see this and could not remember why I made this change.  All I can come up with is this commit message, which describes the change:

          Avoid display corruption on :vsp and 'go' changes

          Always redraw the screen when splitting vertically or when the 'go'
          option is modified (it may e.g. cause scrollbars to hide/show).

      So, it seems to be related to vertical splitting.  Perhaps there is a better way to solve the problem?

      Björn

      --
      --
      You received this message from the "vim_mac" 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_mac" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_mac+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
       
       
    • yeer kunth
      In my situation, I did not setup vertically splitting. Need further conditions to redraw it with CLEAR? You are right, there is a way to solve the problem. My
      Message 2 of 4 , Jul 18 8:55 AM
      • 0 Attachment
        In my situation, I did not setup vertically splitting.

        Need further conditions to redraw it with CLEAR?

        You are right, there is a way to solve the problem.

        My workaround is make the function return multi line value.

        function! TestEcho()
        let v = winsaveview()
        try
        return "foobar\n"
        finally
        call winrestview(v)
        endtry
        endfunction


        When the return value contains more than 1 line, it can be displayed on the status line.

        The side effect is the annoying "Press ENTER or type command to continue" popup too.

        --
        --
        You received this message from the "vim_mac" 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_mac" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_mac+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • björn
        ... I m sure my patch is stupid, but if I simply take it away it will break the problem I was fixing in the first place. The patch should be fixed, but right
        Message 3 of 4 , Jul 25 1:02 PM
        • 0 Attachment
          On Thu, Jul 18, 2013 at 5:55 PM, yeer kunth wrote:

          In my situation, I did not setup vertically splitting.

          Need further conditions to redraw it with CLEAR?

          I'm sure my patch is stupid, but if I simply take it away it will break the problem I was fixing in the first place.  The patch should be fixed, but right now I don't know how.  Sorry.

          Björn

          --
          --
          You received this message from the "vim_mac" 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_mac" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_mac+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
           
           
        Your message has been successfully submitted and would be delivered to recipients shortly.