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

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

Expand Messages
  • Vlad Irnov
    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.
    • Show all 7 messages in this topic