MCPcopy Create free account
hub / github.com/coder/ghostty-web / selectLines

Method selectLines

lib/selection-manager.ts:288–306  ·  view source on GitHub ↗

* Select entire lines from start to end * xterm.js compatible API

(start: number, end: number)

Source from the content-addressed store, hash-verified

286 * xterm.js compatible API
287 */
288 selectLines(start: number, end: number): void {
289 const dims = this.wasmTerm.getDimensions();
290
291 // Clamp to valid row ranges
292 start = Math.max(0, Math.min(start, dims.rows - 1));
293 end = Math.max(0, Math.min(end, dims.rows - 1));
294
295 // Ensure start <= end
296 if (start > end) {
297 [start, end] = [end, start];
298 }
299
300 // Convert viewport rows to absolute rows
301 const viewportY = this.getViewportY();
302 this.selectionStart = { col: 0, absoluteRow: viewportY + start };
303 this.selectionEnd = { col: dims.cols - 1, absoluteRow: viewportY + end };
304 this.requestRender();
305 this.selectionChangedEmitter.fire();
306 }
307
308 /**
309 * Get selection position as buffer range

Callers

nothing calls this directly

Calls 4

getViewportYMethod · 0.95
requestRenderMethod · 0.95
getDimensionsMethod · 0.65
fireMethod · 0.45

Tested by

no test coverage detected