Mercurial > vim
comparison src/regexp.c @ 4043:80b041b994d1 v7.3.776
updated for version 7.3.776
Problem: ml_get error when searching, caused by curwin not matching curbuf.
Solution: Avoid changing curbuf. (Lech Lorens)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 23 Jan 2013 15:53:15 +0100 |
parents | 59130cd78dfc |
children | be4baed0c933 |
comparison
equal
deleted
inserted
replaced
4042:874910cb3cf5 | 4043:80b041b994d1 |
---|---|
3621 linenr_T lnum; /* nr of line to start looking for match */ | 3621 linenr_T lnum; /* nr of line to start looking for match */ |
3622 colnr_T col; /* column to start looking for match */ | 3622 colnr_T col; /* column to start looking for match */ |
3623 proftime_T *tm; /* timeout limit or NULL */ | 3623 proftime_T *tm; /* timeout limit or NULL */ |
3624 { | 3624 { |
3625 long r; | 3625 long r; |
3626 buf_T *save_curbuf = curbuf; | |
3627 | 3626 |
3628 reg_match = NULL; | 3627 reg_match = NULL; |
3629 reg_mmatch = rmp; | 3628 reg_mmatch = rmp; |
3630 reg_buf = buf; | 3629 reg_buf = buf; |
3631 reg_win = win; | 3630 reg_win = win; |
3636 #ifdef FEAT_MBYTE | 3635 #ifdef FEAT_MBYTE |
3637 ireg_icombine = FALSE; | 3636 ireg_icombine = FALSE; |
3638 #endif | 3637 #endif |
3639 ireg_maxcol = rmp->rmm_maxcol; | 3638 ireg_maxcol = rmp->rmm_maxcol; |
3640 | 3639 |
3641 /* Need to switch to buffer "buf" to make vim_iswordc() work. */ | |
3642 curbuf = buf; | |
3643 r = vim_regexec_both(NULL, col, tm); | 3640 r = vim_regexec_both(NULL, col, tm); |
3644 curbuf = save_curbuf; | |
3645 | 3641 |
3646 return r; | 3642 return r; |
3647 } | 3643 } |
3648 | 3644 |
3649 /* | 3645 /* |
4183 { | 4179 { |
4184 int mark = OPERAND(scan)[0]; | 4180 int mark = OPERAND(scan)[0]; |
4185 int cmp = OPERAND(scan)[1]; | 4181 int cmp = OPERAND(scan)[1]; |
4186 pos_T *pos; | 4182 pos_T *pos; |
4187 | 4183 |
4188 pos = getmark(mark, FALSE); | 4184 pos = getmark_buf(reg_buf, mark, FALSE); |
4189 if (pos == NULL /* mark doesn't exist */ | 4185 if (pos == NULL /* mark doesn't exist */ |
4190 || pos->lnum <= 0 /* mark isn't set (in curbuf) */ | 4186 || pos->lnum <= 0 /* mark isn't set (in curbuf) */ |
4191 || (pos->lnum == reglnum + reg_firstlnum | 4187 || (pos->lnum == reglnum + reg_firstlnum |
4192 ? (pos->col == (colnr_T)(reginput - regline) | 4188 ? (pos->col == (colnr_T)(reginput - regline) |
4193 ? (cmp == '<' || cmp == '>') | 4189 ? (cmp == '<' || cmp == '>') |
4313 status = RA_NOMATCH; /* previous char is in same word */ | 4309 status = RA_NOMATCH; /* previous char is in same word */ |
4314 } | 4310 } |
4315 #endif | 4311 #endif |
4316 else | 4312 else |
4317 { | 4313 { |
4318 if (!vim_iswordc(c) | 4314 if (!vim_iswordc_buf(c, reg_buf) |
4319 || (reginput > regline && vim_iswordc(reginput[-1]))) | 4315 || (reginput > regline && vim_iswordc_buf(reginput[-1], reg_buf))) |
4320 status = RA_NOMATCH; | 4316 status = RA_NOMATCH; |
4321 } | 4317 } |
4322 break; | 4318 break; |
4323 | 4319 |
4324 case EOW: /* word\>; reginput points after d */ | 4320 case EOW: /* word\>; reginput points after d */ |
4337 status = RA_NOMATCH; | 4333 status = RA_NOMATCH; |
4338 } | 4334 } |
4339 #endif | 4335 #endif |
4340 else | 4336 else |
4341 { | 4337 { |
4342 if (!vim_iswordc(reginput[-1]) | 4338 if (!vim_iswordc_buf(reginput[-1], reg_buf) |
4343 || (reginput[0] != NUL && vim_iswordc(c))) | 4339 || (reginput[0] != NUL && vim_iswordc_buf(c, reg_buf))) |
4344 status = RA_NOMATCH; | 4340 status = RA_NOMATCH; |
4345 } | 4341 } |
4346 break; /* Matched with EOW */ | 4342 break; /* Matched with EOW */ |
4347 | 4343 |
4348 case ANY: | 4344 case ANY: |