Sunday, November 6, 2011

Re: [Suggestion] New functions iskeywordchar(), isfnamechar(), isprintchar(), and isidentchar()

On 11/06/11 13:22, Axel Bender wrote:
> Having obtained the current byte index using col("."), I can't
> simply add n to/subtract n from the return value of col(".")
> to find the beginning of the next/previous multi-byte
> character (the -1 offset is ok because there's a base bias). I
> could use col(".") repeatedly but I would have to move the
> cursor ("normal l" or "normal h") beforehand. Also, I could
> write a function that would analyze the UTF-8 header bits
> ("11110", "1110", "110", or "10") to determine the required
> position, but I was hoping that there's another (easier) way
> to accomplish this.

Is there a big picture we can help work towards?

One method that occurs to me is possibly something like

match(getline('.'), '\%'.MYCOL.'c\k')

which I haven't tested, but it might get you the info you need
since the docs on match() indicate that it may have the indexing
smarts regarding multibyte characters.

-tim


--
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

No comments: