* Convert pixel coordinates to terminal cell coordinates
(x: number, y: number)
| 753 | * Convert pixel coordinates to terminal cell coordinates |
| 754 | */ |
| 755 | private pixelToCell(x: number, y: number): { col: number; row: number } { |
| 756 | const metrics = this.renderer.getMetrics(); |
| 757 | |
| 758 | const col = Math.floor(x / metrics.width); |
| 759 | const row = Math.floor(y / metrics.height); |
| 760 | |
| 761 | // Clamp to terminal bounds |
| 762 | return { |
| 763 | col: Math.max(0, Math.min(col, this.terminal.cols - 1)), |
| 764 | row: Math.max(0, Math.min(row, this.terminal.rows - 1)), |
| 765 | }; |
| 766 | } |
| 767 | |
| 768 | /** |
| 769 | * Normalize selection coordinates (handle backward selection) |
no test coverage detected