diff src/regexp_nfa.c @ 30156:d58331e0f14a v9.0.0414

patch 9.0.0414: matchstr() still does not match column offset Commit: https://github.com/vim/vim/commit/753aead960f163d0d3f8ce523ea523f2e0cec06d Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 8 12:17:06 2022 +0100 patch 9.0.0414: matchstr() still does not match column offset Problem: matchstr() still does not match column offset when done after a text search. Solution: Only use the line number for a multi-line search. Fix the test. (closes #10938)
author Bram Moolenaar <Bram@vim.org>
date Thu, 08 Sep 2022 13:30:03 +0200
parents 22a5ccc0d634
children a52697bcffa6
line wrap: on
line diff
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -6775,12 +6775,14 @@ nfa_regmatch(
 		    }
 		    if (!result)
 		    {
-			linenr_T    lnum = rex.reg_firstlnum + rex.lnum;
-			long_u	    vcol = 0;
-
-			if (lnum >= 0
-				   && lnum <= wp->w_buffer->b_ml.ml_line_count)
-			    vcol = (long_u)win_linetabsize(wp, lnum,
+			linenr_T    lnum = REG_MULTI
+					    ? rex.reg_firstlnum + rex.lnum : 1;
+			long_u	    vcol;
+
+			if (REG_MULTI && (lnum <= 0
+				   || lnum > wp->w_buffer->b_ml.ml_line_count))
+			    lnum = 1;
+			vcol = (long_u)win_linetabsize(wp, lnum,
 								rex.line, col);
 			result = nfa_re_num_cmp(t->state->val, op, vcol + 1);
 		    }