Patch 8.2.5150
Problem:    Read past the end of the first line with ":0;'{".
Solution:   When on line zero check the column is valid for line one.
Files:      src/ex_docmd.c, src/testdir/test_cmdline.vim


*** ../vim-8.2.5149/src/ex_docmd.c      2022-06-18 19:48:10.813508250 +0100
--- src/ex_docmd.c      2022-06-22 19:04:37.014520816 +0100
***************
*** 3411,3420 ****
                curwin->w_cursor.lnum = eap->line2;
  
                // Don't leave the cursor on an illegal line or column, but do
!               // accept zero as address, so 0;/PATTERN/ works correctly.
                // Check the cursor position before returning.
                if (eap->line2 > 0)
                    check_cursor();
                need_check_cursor = TRUE;
            }
        }
--- 3411,3423 ----
                curwin->w_cursor.lnum = eap->line2;
  
                // Don't leave the cursor on an illegal line or column, but do
!               // accept zero as address, so 0;/PATTERN/ works correctly
!               // (where zero usually means to use the first line).
                // Check the cursor position before returning.
                if (eap->line2 > 0)
                    check_cursor();
+               else
+                   check_cursor_col();
                need_check_cursor = TRUE;
            }
        }
*** ../vim-8.2.5149/src/testdir/test_cmdline.vim        2022-06-22 
13:51:50.853604054 +0100
--- src/testdir/test_cmdline.vim        2022-06-22 19:02:12.238944557 +0100
***************
*** 808,813 ****
--- 808,821 ----
    call delete('Xtest.vim')
  endfunc
  
+ func Test_mark_from_line_zero()
+   " this was reading past the end of the first (empty) line
+   new
+   norm oxxxx
+   call assert_fails("0;'(", 'E20:')
+   bwipe!
+ endfunc
+ 
  func Test_cmdline_complete_wildoptions()
    help
    call feedkeys(":tag /\<c-a>\<c-b>\"\<cr>", 'tx')
*** ../vim-8.2.5149/src/version.c       2022-06-22 18:14:25.768740990 +0100
--- src/version.c       2022-06-22 19:06:55.186177917 +0100
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     5150,
  /**/

-- 
Sometimes you can protect millions of dollars in your budget simply by buying
a bag of cookies, dropping it on the budget anylyst's desk, and saying
something deeply personal such as "How was your weekend, big guy?"
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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

--- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220622181004.5F58B1C0A8A%40moolenaar.net.

Raspunde prin e-mail lui