/** Returns a next grapheme cluster break _after_ (not equal to) `pos`, if `forward` is true, or before otherwise. Returns `pos` itself if no further cluster break is available in the string. Moves across surrogate pairs, extending characters (when `includeExtending` is true), characters joined with zero-width joiners, and flag emoji. */ declare function findClusterBreak(str: string, pos: number, forward?: boolean, includeExtending?: boolean): number; /** Find the code point at the given position in a string (like the [`codePointAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt) string method). */ declare function codePointAt(str: string, pos: number): number; /** Given a Unicode codepoint, return the JavaScript string that respresents it (like [`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint)). */ declare function fromCodePoint(code: number): string; /** The first character that takes up two positions in a JavaScript string. It is often useful to compare with this after calling `codePointAt`, to figure out whether your character takes up 1 or 2 index positions. */ declare function codePointSize(code: number): 1 | 2; /** Count the column position at the given offset into the string, taking extending characters and tab size into account. */ declare function countColumn(string: string, tabSize: number, to?: number): number; /** Find the offset that corresponds to the given column position in a string, taking extending characters and tab size into account. By default, the string length is returned when it is too short to reach the column. Pass `strict` true to make it return -1 in that situation. */ declare function findColumn(string: string, col: number, tabSize: number, strict?: boolean): number; /** A text iterator iterates over a sequence of strings. When iterating over a [`Text`](https://codemirror.net/6/docs/ref/#text.Text) document, result values will either be lines or line breaks. */ interface TextIterator extends Iterator, Iterable { /** Retrieve the next string. Optionally skip a given number of positions after the current position. Always returns the object itself. */ next(skip?: number): this; /** The current string. Will be the empty string when the cursor is at its end or `next` hasn't been called on it yet. */ value: string; /** Whether the end of the iteration has been reached. You should probably check this right after calling `next`. */ done: boolean; /** Whether the current string represents a line break. */ lineBreak: boolean; } /** The data structure for documents. */ declare abstract class Text implements Iterable { /** The length of the string. */ abstract readonly length: number; /** The number of lines in the string (always >= 1). */ abstract readonly lines: number; /** Get the line description around the given position. */ lineAt(pos: number): Line; /** Get the description for the given (1-based) line number. */ line(n: number): Line; /** Replace a range of the text with the given content. */ replace(from: number, to: number, text: Text): Text; /** Append another document to this one. */ append(other: Text): Text; /** Retrieve the text between the given points. */ slice(from: number, to?: number): Text; /** Retrieve a part of the document as a string */ abstract sliceString(from: number, to?: number, lineSep?: string): string; /** Test whether this text is equal to another instance. */ eq(other: Text): boolean; /** Iterate over the text. When `dir` is `-1`, iteration happens from end to start. This will return lines and the breaks between them as separate strings, and for long lines, might split lines themselves into multiple chunks as well. */ iter(dir?: 1 | -1): TextIterator; /** Iterate over a range of the text. When `from` > `to`, the iterator will run in reverse. */ iterRange(from: number, to?: number): TextIterator; /** Return a cursor that iterates over the given range of lines, _without_ returning the line breaks between, and yielding empty strings for empty lines. When `from` and `to` are given, they should be 1-based line numbers. */ iterLines(from?: number, to?: number): TextIterator; /** Convert the document to an array of lines (which can be deserialized again via [`Text.of`](https://codemirror.net/6/docs/ref/#text.Text^of)). */ toJSON(): string[]; /** If this is a branch node, `children` will hold the `Text` objects that it is made up of. For leaf nodes, this holds null. */ abstract readonly children: readonly Text[] | null; [Symbol.iterator]: () => Iterator; /** Create a `Text` instance for the given array of lines. */ static of(text: readonly string[]): Text; /** The empty document. */ static empty: Text; } /** This type describes a line in the document. It is created on-demand when lines are [queried](https://codemirror.net/6/docs/ref/#text.Text.lineAt). */ declare class Line { /** The position of the start of the line. */ readonly from: number; /** The position at the end of the line (_before_ the line break, or at the end of document for the last line). */ readonly to: number; /** This line's line number (1-based). */ readonly number: number; /** The line's content. */ readonly text: string; /** The length of the line (not including any line break after it). */ get length(): number; } export { Line, Text, TextIterator, codePointAt, codePointSize, countColumn, findClusterBreak, findColumn, fromCodePoint };