Skip to main content
Module

x/denops_std/function/mod.ts>line2byte

📚 Standard module for denops.vim
Go to Latest
function line2byte
import { line2byte } from "https://deno.land/x/denops_std@v6.4.0/function/mod.ts";

Return the byte count from the start of the buffer for line {lnum}. This includes the end-of-line character, depending on the 'fileformat' option for the current buffer. The first line returns 1. 'encoding' matters, 'fileencoding' is ignored. This can also be used to get the byte count for the line just below the last line:

line2byte(line("$") + 1)

This is the buffer size plus one. If 'fileencoding' is empty it is the file size plus one. {lnum} is used like with getline(). When {lnum} is invalid, or the +byte_offset feature has been disabled at compile time, -1 is returned. Also see byte2line(), go and :goto.

Can also be used as a method:

GetLnum()->line2byte()

Parameters

denops: Denops
lnum: number

Returns

Promise<number>