Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddc_vim/deps.ts>fn.byteidxcomp

Dark deno-powered completion framework for neovim/Vim
Go to Latest
function fn.byteidxcomp
import { fn } from "https://deno.land/x/ddc_vim@v4.0.2/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)

Parameters

denops: Denops
expr: unknown
nr: unknown
optional
utf16: unknown

Returns

Promise<number>