comparison src/regexp_bt.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 7fb4e244b16e
comparison
equal deleted inserted replaced
30155:a85a8accd273 30156:d58331e0f14a
3439 break; 3439 break;
3440 3440
3441 case RE_VCOL: 3441 case RE_VCOL:
3442 { 3442 {
3443 win_T *wp = rex.reg_win == NULL ? curwin : rex.reg_win; 3443 win_T *wp = rex.reg_win == NULL ? curwin : rex.reg_win;
3444 linenr_T lnum = rex.reg_firstlnum + rex.lnum; 3444 linenr_T lnum = REG_MULTI ? rex.reg_firstlnum + rex.lnum : 1;
3445 long_u vcol = 0; 3445 long_u vcol;
3446 3446
3447 if (lnum >= 0 && lnum <= wp->w_buffer->b_ml.ml_line_count) 3447 if (REG_MULTI && (lnum <= 0
3448 vcol = (long_u)win_linetabsize(wp, lnum, rex.line, 3448 || lnum > wp->w_buffer->b_ml.ml_line_count))
3449 lnum = 1;
3450 vcol = (long_u)win_linetabsize(wp, lnum, rex.line,
3449 (colnr_T)(rex.input - rex.line)); 3451 (colnr_T)(rex.input - rex.line));
3450 if (!re_num_cmp(vcol + 1, scan)) 3452 if (!re_num_cmp(vcol + 1, scan))
3451 status = RA_NOMATCH; 3453 status = RA_NOMATCH;
3452 } 3454 }
3453 break; 3455 break;