* Render cursor
(x: number, y: number)
| 711 | * Render cursor |
| 712 | */ |
| 713 | private renderCursor(x: number, y: number): void { |
| 714 | const cursorX = x * this.metrics.width; |
| 715 | const cursorY = y * this.metrics.height; |
| 716 | |
| 717 | this.ctx.fillStyle = this.theme.cursor; |
| 718 | |
| 719 | switch (this.cursorStyle) { |
| 720 | case 'block': |
| 721 | // Full cell block |
| 722 | this.ctx.fillRect(cursorX, cursorY, this.metrics.width, this.metrics.height); |
| 723 | break; |
| 724 | |
| 725 | case 'underline': |
| 726 | // Underline at bottom of cell |
| 727 | const underlineHeight = Math.max(2, Math.floor(this.metrics.height * 0.15)); |
| 728 | this.ctx.fillRect( |
| 729 | cursorX, |
| 730 | cursorY + this.metrics.height - underlineHeight, |
| 731 | this.metrics.width, |
| 732 | underlineHeight |
| 733 | ); |
| 734 | break; |
| 735 | |
| 736 | case 'bar': |
| 737 | // Vertical bar at left of cell |
| 738 | const barWidth = Math.max(2, Math.floor(this.metrics.width * 0.15)); |
| 739 | this.ctx.fillRect(cursorX, cursorY, barWidth, this.metrics.height); |
| 740 | break; |
| 741 | } |
| 742 | } |
| 743 | |
| 744 | // ========================================================================== |
| 745 | // Cursor Blinking |