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

[patch] Bug with :g command and folded lines

Expand Messages
  • Christian Brabandt
    Hi Bram, I just noticed there is an error when using :g command with folded lines. take this file: #v+ ~$ cat vim_bug.txt 1 1 2 2 1 1 1 1 vim:fdm=expr fdl=0
    Message 1 of 2 , Nov 4, 2011
    • 0 Attachment
      Hi Bram,
      I just noticed there is an error when using :g command with folded lines.

      take this file:
      #v+
      ~$ cat vim_bug.txt
      1
      1
      2
      2
      1
      1
      1
      1
      vim:fdm=expr fdl=0 fde=getline(v\:lnum)==1
      ~$ vim -u NONE -U NONE -N -i NONE -c 'folddoclosed m$' vim_bug.txt
      E315: ml_get: invalid lnum: 11
      #v-

      This patch fixes it. Please check and include.

      diff --git a/src/ex_cmds.c b/src/ex_cmds.c
      --- a/src/ex_cmds.c
      +++ b/src/ex_cmds.c
      @@ -819,7 +819,12 @@
      curwin->w_cursor.lnum = dest + (line2 - line1) + 1;

      if (line1 < dest)
      - changed_lines(line1, 0, dest + num_lines + 1, 0L);
      + {
      + if (dest + num_lines + 1 > curwin->w_buffer->b_ml.ml_line_count)
      + changed_lines(line1, 0, curwin->w_buffer->b_ml.ml_line_count + 1, 0L);
      + else
      + changed_lines(line1, 0, dest + num_lines + 1, 0L);
      + }
      else
      changed_lines(dest + 1, 0, line1 + num_lines, 0L);


      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
    • Bram Moolenaar
      ... Thanks for the patch. I ll look into it the coming week. -- hundred-and-one symptoms of being an internet addict: 184. You no longer ask prospective dates
      Message 2 of 2 , Nov 26, 2011
      • 0 Attachment
        Christian Brabandt wrote:

        > I just noticed there is an error when using :g command with folded lines.
        >
        > take this file:
        > #v+
        > ~$ cat vim_bug.txt
        > 1
        > 1
        > 2
        > 2
        > 1
        > 1
        > 1
        > 1
        > vim:fdm=expr fdl=0 fde=getline(v\:lnum)==1
        > ~$ vim -u NONE -U NONE -N -i NONE -c 'folddoclosed m$' vim_bug.txt
        > E315: ml_get: invalid lnum: 11
        > #v-
        >
        > This patch fixes it. Please check and include.

        Thanks for the patch. I'll look into it the coming week.

        --
        hundred-and-one symptoms of being an internet addict:
        184. You no longer ask prospective dates what their sign is, instead
        your line is "Hi, what's your URL?"

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