* Select text at specific column and row with length * xterm.js compatible API
(column: number, row: number, length: number)
| 255 | * xterm.js compatible API |
| 256 | */ |
| 257 | select(column: number, row: number, length: number): void { |
| 258 | // Clamp to valid ranges |
| 259 | const dims = this.wasmTerm.getDimensions(); |
| 260 | row = Math.max(0, Math.min(row, dims.rows - 1)); |
| 261 | column = Math.max(0, Math.min(column, dims.cols - 1)); |
| 262 | |
| 263 | // Calculate end position |
| 264 | let endRow = row; |
| 265 | let endCol = column + length - 1; |
| 266 | |
| 267 | // Handle wrapping if selection extends past end of line |
| 268 | while (endCol >= dims.cols) { |
| 269 | endCol -= dims.cols; |
| 270 | endRow++; |
| 271 | } |
| 272 | |
| 273 | // Clamp end row |
| 274 | endRow = Math.min(endRow, dims.rows - 1); |
| 275 | |
| 276 | // Convert viewport rows to absolute rows |
| 277 | const viewportY = this.getViewportY(); |
| 278 | this.selectionStart = { col: column, absoluteRow: viewportY + row }; |
| 279 | this.selectionEnd = { col: endCol, absoluteRow: viewportY + endRow }; |
| 280 | this.requestRender(); |
| 281 | this.selectionChangedEmitter.fire(); |
| 282 | } |
| 283 | |
| 284 | /** |
| 285 | * Select entire lines from start to end |
no test coverage detected