Monday, April 25, 2016

Re: Capture columns nummers of matches ending with double byte chars

Hi rameo,

2016/4/23 Sat 21:37:15 UTC+9 rameo wrote:
> Searchpos() doesn't return the right end value of a match if the match end with a double byte character (èéòìùá...). (encoding utf-8)
> Isn't this a bug????

You might misunderstand the spec of searchpos().
When the 'e' flag is specified, the cursor moves to the last character of
the match and searchpos() returns the position of the cursor. It means
that the returned value is a byte index of start of the last character,
not the end of the character.


> The last few years I used match/matchend then I noted that it did not capture correctly double byte characters within the string.

Can you show an example?
match()/matchend() return a byte offset, not a character count.

FYI, matchstrpos() can be used to get both start and end position
after 7.4.1685.


Regards,
Ken Takata

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: