From 89acf6126a5d2520783557faacf261fdd72c665c Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Sat, 15 Nov 2025 22:37:03 +0000 Subject: [PATCH] chore: improve default highlight color --- demo/index.html | 2 +- lib/input-handler.ts | 7 ------- lib/renderer.test.ts | 2 +- lib/renderer.ts | 2 +- lib/selection-manager.ts | 19 ++----------------- 5 files changed, 5 insertions(+), 27 deletions(-) diff --git a/demo/index.html b/demo/index.html index 68777eaf..811b6b57 100644 --- a/demo/index.html +++ b/demo/index.html @@ -548,7 +548,7 @@

📚 Available Commands

foreground: '#d4d4d4', cursor: '#ffffff', cursorAccent: '#000000', - selectionBackground: '#264f78', + selectionBackground: 'rgba(255, 255, 255, 0.3)', selectionForeground: '#ffffff', black: '#000000', red: '#cd3131', diff --git a/lib/input-handler.ts b/lib/input-handler.ts index 889c45a0..9e31c3dd 100644 --- a/lib/input-handler.ts +++ b/lib/input-handler.ts @@ -270,7 +270,6 @@ export class InputHandler { // Allow Ctrl+V and Cmd+V to trigger paste event (don't preventDefault) if ((event.ctrlKey || event.metaKey) && event.code === 'KeyV') { // Let the browser's native paste event fire - console.log('[InputHandler] ⌨️ Ctrl/Cmd+V detected, allowing paste event'); return; } @@ -279,7 +278,6 @@ export class InputHandler { // Note: Ctrl+C on all platforms sends interrupt signal (0x03) if (event.metaKey && event.code === 'KeyC') { // Let browser/SelectionManager handle copy - console.log('[InputHandler] ⌨️ Cmd+C detected, allowing copy'); return; } @@ -459,11 +457,6 @@ export class InputHandler { return; } - console.log( - '[InputHandler] 📋 Pasting text:', - text.substring(0, 50) + (text.length > 50 ? '...' : '') - ); - // Send the text to the terminal // Note: For bracketed paste mode, we would wrap this in \x1b[200~ ... \x1b[201~ // but for now, send raw text diff --git a/lib/renderer.test.ts b/lib/renderer.test.ts index 60683857..9f791170 100644 --- a/lib/renderer.test.ts +++ b/lib/renderer.test.ts @@ -44,7 +44,7 @@ describe('CanvasRenderer', () => { }); test('has selection colors', () => { - expect(DEFAULT_THEME.selectionBackground).toBe('#264f78'); + expect(DEFAULT_THEME.selectionBackground).toBe('rgba(255, 255, 255, 0.3)'); expect(DEFAULT_THEME.selectionForeground).toBe('#d4d4d4'); }); }); diff --git a/lib/renderer.ts b/lib/renderer.ts index 27ecaf54..4b25a1d7 100644 --- a/lib/renderer.ts +++ b/lib/renderer.ts @@ -52,7 +52,7 @@ export const DEFAULT_THEME: Required = { background: '#1e1e1e', cursor: '#ffffff', cursorAccent: '#1e1e1e', - selectionBackground: '#264f78', + selectionBackground: 'rgba(255, 255, 255, 0.3)', selectionForeground: '#d4d4d4', black: '#000000', red: '#cd3131', diff --git a/lib/selection-manager.ts b/lib/selection-manager.ts index 47892a41..5cf5c21e 100644 --- a/lib/selection-manager.ts +++ b/lib/selection-manager.ts @@ -202,7 +202,6 @@ export class SelectionManager { canvas.addEventListener('mousedown', (e: MouseEvent) => { if (e.button === 0) { // Left click only - console.log('[Selection] 🖱️ mousedown - starting selection'); // CRITICAL: Focus the terminal so it can receive keyboard input // The canvas doesn't have tabindex, but the parent container does @@ -222,7 +221,6 @@ export class SelectionManager { this.selectionStart = cell; this.selectionEnd = cell; this.isSelecting = true; - console.log('[Selection] ✅ isSelecting = true'); } }); @@ -238,7 +236,6 @@ export class SelectionManager { // Mouse leave - stop selecting if mouse leaves canvas while dragging canvas.addEventListener('mouseleave', (e: MouseEvent) => { if (this.isSelecting) { - console.log('[Selection] ⚠️ mouseleave while selecting - but keeping selection active'); // DON'T clear isSelecting here - allow dragging outside canvas // The document mouseup handler will catch the release } @@ -248,9 +245,7 @@ export class SelectionManager { // This catches mouseup events that happen outside the canvas (common during drag) this.boundMouseUpHandler = (e: MouseEvent) => { if (this.isSelecting) { - console.log('[Selection] 🖱️ mouseup - stopping selection'); this.isSelecting = false; - console.log('[Selection] ✅ isSelecting = false'); const text = this.getSelection(); if (text) { @@ -287,7 +282,6 @@ export class SelectionManager { const text = this.getSelection(); if (text) { this.copyToClipboard(text); - console.log('Copied selection to clipboard (via right-click)'); } } }); @@ -370,10 +364,7 @@ export class SelectionManager { navigator.clipboard .writeText(text) .then(() => { - console.log( - '✅ Copied to clipboard (Clipboard API):', - text.substring(0, 50) + (text.length > 50 ? '...' : '') - ); + // Successfully copied }) .catch((err) => { console.error('❌ Clipboard API failed:', err); @@ -382,7 +373,6 @@ export class SelectionManager { }); } else { // Fallback to execCommand for non-secure contexts (like mux.coder) - console.log('💡 Using fallback copy method (Clipboard API requires HTTPS)'); this.copyToClipboardFallback(text); } } @@ -416,12 +406,7 @@ export class SelectionManager { previouslyFocused.focus(); } - if (successful) { - console.log( - '✅ Copied to clipboard (fallback):', - text.substring(0, 50) + (text.length > 50 ? '...' : '') - ); - } else { + if (!successful) { console.error('❌ Copy failed (both methods)'); } } catch (err) {