import { fn } from "https://deno.land/x/ddc_vim@v4.1.0/deps.ts";
const { byteidxcomp } = fn;
Like byteidx(), except that a composing character is counted as a separate character. Example:
let s = 'e' .. nr2char(0x301)
echo byteidx(s, 1)
echo byteidxcomp(s, 1)
echo byteidxcomp(s, 2)
The first and third echo result in 3 ('e' plus composing character is 3 bytes), the second echo results in 1 ('e' is one byte). Only works differently from byteidx() when 'encoding' is set to a Unicode encoding.
Can also be used as a method
:
GetName()->byteidxcomp(idx)