export function getVisibleLines()

in src/lib/CodeMirror/indentationMarkers.ts [15:33]


export function getVisibleLines(view: EditorView, state = view.state): Set<Line> {
	const lines = new Set<Line>();

	for (const { from, to } of view.visibleRanges) {
		let pos = from;

		while (pos <= to) {
			const line = state.doc.lineAt(pos);

			if (!lines.has(line)) {
				lines.add(line);
			}

			pos = line.to + 1;
		}
	}

	return lines;
}