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

Re: Issue 121 in vim: cursor jumps to the end of closed fold when executing a register

Expand Messages
  • Christian Brabandt
    ... I don t see this with Vim. Can you reproduce the issue with vim -u NONE -N ? regards, Christian -- -- You received this message from the vim_dev
    Message 1 of 7 , Mar 12, 2013
    • 0 Attachment
      On Tue, March 12, 2013 14:06, vim@... wrote:
      > Status: New
      > Owner: ----
      > Labels: Type-Defect Priority-Medium
      >
      > New issue 121 by vlad.ir...@...: cursor jumps to the end of closed
      > fold when executing a register
      > http://code.google.com/p/vim/issues/detail?id=121
      >
      > What steps will reproduce the problem?
      >
      > The following code shows how to reproduce this issue. I use netrw help
      > file
      > as an example because it's a large file with many folds.
      >
      > "-----BEGIN-----------------------------
      > edit $VIMRUNTIME/doc/pi_netrw.txt
      > set fdm=marker fdl=0
      > " Position cursor on the first line of the first closed fold.
      > normal! ggzj
      > let @z = "echo line('.')"
      > echo line('.')
      > @z
      > echo line('.')
      > "-----END-------------------------------
      >
      >
      > What is the expected output? What do you see instead?
      >
      > The cursor position should not change.
      > Insted, it jumps to the last line in the closed fold.
      >
      >
      > What version of the product are you using? On what operating system?
      >
      > Vim 7.3.829 from Cream project, Windows XP.

      I don't see this with Vim. Can you reproduce the issue with vim -u NONE -N
      ?

      regards,
      Christian

      --
      --
      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/groups/opt_out.
    • glts
      ... I can reproduce this on the current Vim version 7.3.854 on Ubuntu Linux 12.04. David -- -- You received this message from the vim_dev maillist. Do not
      Message 2 of 7 , Mar 12, 2013
      • 0 Attachment
        On Tuesday, March 12, 2013 5:22:12 PM UTC+1, Christian Brabandt wrote:
        > I don't see this with Vim. Can you reproduce the issue with vim -u
        > NONE -N ?

        I can reproduce this on the current Vim version 7.3.854 on Ubuntu Linux
        12.04.

        David

        --
        --
        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/groups/opt_out.
      • Christian Brabandt
        Hi glts! ... Ah, I see, this only happens when sourcing as a script. The problem here is, that there is a subtle difference between the :@ command and the ...
        Message 3 of 7 , Mar 12, 2013
        • 0 Attachment
          Hi glts!

          On Di, 12 Mär 2013, glts wrote:

          > On Tuesday, March 12, 2013 5:22:12 PM UTC+1, Christian Brabandt wrote:
          > > I don't see this with Vim. Can you reproduce the issue with vim -u
          > > NONE -N ?
          >
          > I can reproduce this on the current Vim version 7.3.854 on Ubuntu Linux
          > 12.04.

          Ah, I see, this only happens when sourcing as a script. The problem here
          is, that there is a subtle difference between the :@ command and the
          :normal! @ command. When using the :@ command, the register will be
          called for the range of the folded lines and therefore implicitly sets
          the range to the first and lastline of the fold and then the ex_at()
          function explicitly sets the cursorline to the endline of the register.

          We could change it, but the documentation explicitly states, that in the
          future the register will be executed for the range given, so we should
          rather just implement this ;)

          Mit freundlichen Grüßen
          Christian
          --
          Geistliche sind daran interessiert, die Völker in Unwissenheit zu
          erhalten, man würde sonst, da das Evangelium einfach ist, ihnen sagen:
          Wir wissen das alles so gut wie ihr.
          -- Charles-Louis Baron de Montesquieu (Gedanken, Über die Religion)

          --
          --
          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/groups/opt_out.
        • Christian Brabandt
          Hi ... Attached is a patch regards, Christian -- Wer freudig ist, hat zu allen Dingen den rechten Stand. -- Romano Guardini -- -- You received this message
          Message 4 of 7 , Mar 12, 2013
          • 0 Attachment
            Hi

            On Di, 12 Mär 2013, Christian Brabandt wrote:

            > Ah, I see, this only happens when sourcing as a script. The problem here
            > is, that there is a subtle difference between the :@ command and the
            > :normal! @ command. When using the :@ command, the register will be
            > called for the range of the folded lines and therefore implicitly sets
            > the range to the first and lastline of the fold and then the ex_at()
            > function explicitly sets the cursorline to the endline of the register.
            >
            > We could change it, but the documentation explicitly states, that in the
            > future the register will be executed for the range given, so we should
            > rather just implement this ;)

            Attached is a patch


            regards,
            Christian
            --
            Wer freudig ist, hat zu allen Dingen den rechten Stand.
            -- Romano Guardini

            --
            --
            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/groups/opt_out.
          • glts
            Hi Christian, ... yes, I saw the problem. ... Unfortunately, the expression in the future is very relative generally speaking and with Vim in particular. For
            Message 5 of 7 , Mar 12, 2013
            • 0 Attachment
              Hi Christian,

              On Tuesday, March 12, 2013 9:16:04 PM UTC+1, Christian Brabandt wrote:
              > Ah, I see, this only happens when sourcing as a script. The problem here
              > is, that there is a subtle difference between the :@ command and the
              > :normal! @ command. When using the :@ command, the register will be
              > called for the range of the folded lines and therefore implicitly sets
              > the range to the first and lastline of the fold and then the ex_at()
              > function explicitly sets the cursorline to the endline of the register.

              yes, I saw the problem.

              > We could change it, but the documentation explicitly states, that in the
              > future the register will be executed for the range given, so we should
              > rather just implement this ;)

              Unfortunately, the expression "in the future" is very relative generally
              speaking and with Vim in particular.

              For the present, the documentation only requires that the cursor will be
              set to [addr]: "set cursor at line [addr] (default is current line)".
              So, as far as I understand, this issue is easily fixed by removing the
              WHOLEFOLD flag from CMD_at and CMD_star, at least until somebody
              actually implements the promised functionality. See the attached patch.

              --
              --
              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/groups/opt_out.
            • Vlad Irnov
              ... Thanks! I hope this patch will be included. So, when on a closed fold, :@{register} currently behaves like an Ex command that accepts a range as explained
              Message 6 of 7 , Mar 13, 2013
              • 0 Attachment
                On 3/12/13, glts <676c7473@...> wrote:
                > Hi Christian,
                >
                > On Tuesday, March 12, 2013 9:16:04 PM UTC+1, Christian Brabandt wrote:
                >> Ah, I see, this only happens when sourcing as a script. The problem here
                >> is, that there is a subtle difference between the :@ command and the
                >> :normal! @ command. When using the :@ command, the register will be
                >> called for the range of the folded lines and therefore implicitly sets
                >> the range to the first and lastline of the fold and then the ex_at()
                >> function explicitly sets the cursorline to the endline of the register.
                >
                > yes, I saw the problem.
                >
                >> We could change it, but the documentation explicitly states, that in the
                >> future the register will be executed for the range given, so we should
                >> rather just implement this ;)
                >
                > Unfortunately, the expression "in the future" is very relative generally
                > speaking and with Vim in particular.
                >
                > For the present, the documentation only requires that the cursor will be
                > set to [addr]: "set cursor at line [addr] (default is current line)".
                > So, as far as I understand, this issue is easily fixed by removing the
                > WHOLEFOLD flag from CMD_at and CMD_star, at least until somebody
                > actually implements the promised functionality. See the attached patch.

                Thanks! I hope this patch will be included.

                So, when on a closed fold, :@{register} currently behaves like an Ex
                command that accepts a range as explained in doc/fold.txt:
                For Ex commands the range is adjusted to always start at the first
                line of a closed fold and end at the last line of a closed fold.
                But since :@ does not actually do anything with the range, this is
                unexpected and inappropriate.

                Personally, I would prefer that :@{register} did not operate on ranges.
                That is the future feature in ":help :@" should be scrapped:
                {Vi: only in some versions} Future: Will execute the register for
                each line in the address range.

                I use :@{register} a lot to run small snippets of VimScript instead of
                sourcing a file or putting them into functions. It rarely makes sense to
                execute such scripts for each line in a range.

                Regards,
                Vlad

                --
                --
                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/groups/opt_out.
              Your message has been successfully submitted and would be delivered to recipients shortly.