Yukihiro Nakadaira wrote:
> search('multi-byte char', 'bce') does not match at cursor position.
>
> Steps to reproduce:
>
> $ vim -u NONE
> :set encoding=utf-8
> :call setline(1, "\uff21")
> :echo search("\uff21", "bceW") " no wrap scan
> 0
>
> Expected:
>
> 1
>
> I think that the attached patch fixes this problem. Please check it.
>
>
> For search("\uff21", "bce"), Vim checks if matched position is before the
> start
> position with this expression:
>
> regmatch.endpos[0].col - 1 + extra_col <= start_pos.col
> (extra_col = SEARCH_START ? 0 : 1)
>
> normal boundary
> | SEARCH_START boundary
> <-| <-|
> |0|1|2|3|
> | A |
> ^ ^ ^
> | | regmatch.endpos[0].col
> | | LHS: regmatch.endpos[0].col - 1 + extra_col(1)
> | LHS: regmatch.endpos[0].col - 1 + extra_col(0) (LHS<=RHS => false)
> RHS: start_pos.col
>
> This patch change it to:
>
> regmatch.endpos[0].col - 1 < start_pos.col + extra_col
> (extra_col = SEARCH_START ? len(A) : 0)
>
> normal boundary
> | SEARCH_START boundary
> <-| <-|
> |0|1|2|3|
> | A |
> ^ ^ ^
> | | regmatch.endpos[0].col
> | | RHS: start_pos.col + extra_col(len(A)) (LHS<RHS => true)
> | LHS: regmatch.endpos[0].col - 1
> start_pos.col
> RHS: start_pos.col + extra_col(0)
I suppose that's the way to do it. I'll include the patch, thanks!
--
hundred-and-one symptoms of being an internet addict:
196. Your computer costs more than your car.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.