comparison src/ex_cmds.c @ 18483:54e5fa1f9cfc v8.1.2236

patch 8.1.2236: ml_get error if pattern matches beyond last line Commit: https://github.com/vim/vim/commit/bb26596242fa7db477e2cd706dd99f9a426b5f71 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 31 04:38:36 2019 +0100 patch 8.1.2236: ml_get error if pattern matches beyond last line Problem: Ml_get error if pattern matches beyond last line. Solution: Adjust position if needed. (Christian Brabandt, closes https://github.com/vim/vim/issues/5139)
author Bram Moolenaar <Bram@vim.org>
date Thu, 31 Oct 2019 04:45:03 +0100
parents b026f4524f25
children e5ef5d820b5b
comparison
equal deleted inserted replaced
18482:f8975b6004e6 18483:54e5fa1f9cfc
3945 sub_firstlnum += regmatch.startpos[0].lnum; 3945 sub_firstlnum += regmatch.startpos[0].lnum;
3946 nmatch -= regmatch.startpos[0].lnum; 3946 nmatch -= regmatch.startpos[0].lnum;
3947 VIM_CLEAR(sub_firstline); 3947 VIM_CLEAR(sub_firstline);
3948 } 3948 }
3949 3949
3950 // Match might be after the last line for "\n\zs" matching at
3951 // the end of the last line.
3952 if (lnum > curbuf->b_ml.ml_line_count)
3953 break;
3954
3950 if (sub_firstline == NULL) 3955 if (sub_firstline == NULL)
3951 { 3956 {
3952 sub_firstline = vim_strsave(ml_get(sub_firstlnum)); 3957 sub_firstline = vim_strsave(ml_get(sub_firstlnum));
3953 if (sub_firstline == NULL) 3958 if (sub_firstline == NULL)
3954 { 3959 {