comparison src/ex_docmd.c @ 29263:8408ffd9af69 v8.2.5150

patch 8.2.5150: read past the end of the first line with ":0;'{" Commit: https://github.com/vim/vim/commit/f7c7c3fad6d2135d558f3b36d0d1a943118aeb5e Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 22 19:08:38 2022 +0100 patch 8.2.5150: read past the end of the first line with ":0;'{" Problem: Read past the end of the first line with ":0;'{". Solution: When on line zero check the column is valid for line one.
author Bram Moolenaar <Bram@vim.org>
date Wed, 22 Jun 2022 20:15:03 +0200
parents 9e0b45df95b0
children 98de9a961a64
comparison
equal deleted inserted replaced
29262:e6542b089375 29263:8408ffd9af69
3409 if (!eap->skip) 3409 if (!eap->skip)
3410 { 3410 {
3411 curwin->w_cursor.lnum = eap->line2; 3411 curwin->w_cursor.lnum = eap->line2;
3412 3412
3413 // Don't leave the cursor on an illegal line or column, but do 3413 // Don't leave the cursor on an illegal line or column, but do
3414 // accept zero as address, so 0;/PATTERN/ works correctly. 3414 // accept zero as address, so 0;/PATTERN/ works correctly
3415 // (where zero usually means to use the first line).
3415 // Check the cursor position before returning. 3416 // Check the cursor position before returning.
3416 if (eap->line2 > 0) 3417 if (eap->line2 > 0)
3417 check_cursor(); 3418 check_cursor();
3419 else
3420 check_cursor_col();
3418 need_check_cursor = TRUE; 3421 need_check_cursor = TRUE;
3419 } 3422 }
3420 } 3423 }
3421 else if (*eap->cmd != ',') 3424 else if (*eap->cmd != ',')
3422 break; 3425 break;