Skip to content

Commit 1b14219

Browse files
authored
chore: improve default highlight color (#25)
1 parent 6ebde92 commit 1b14219

5 files changed

Lines changed: 5 additions & 27 deletions

File tree

demo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ <h3>📚 Available Commands</h3>
548548
foreground: '#d4d4d4',
549549
cursor: '#ffffff',
550550
cursorAccent: '#000000',
551-
selectionBackground: '#264f78',
551+
selectionBackground: 'rgba(255, 255, 255, 0.3)',
552552
selectionForeground: '#ffffff',
553553
black: '#000000',
554554
red: '#cd3131',

lib/input-handler.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ export class InputHandler {
270270
// Allow Ctrl+V and Cmd+V to trigger paste event (don't preventDefault)
271271
if ((event.ctrlKey || event.metaKey) && event.code === 'KeyV') {
272272
// Let the browser's native paste event fire
273-
console.log('[InputHandler] ⌨️ Ctrl/Cmd+V detected, allowing paste event');
274273
return;
275274
}
276275

@@ -279,7 +278,6 @@ export class InputHandler {
279278
// Note: Ctrl+C on all platforms sends interrupt signal (0x03)
280279
if (event.metaKey && event.code === 'KeyC') {
281280
// Let browser/SelectionManager handle copy
282-
console.log('[InputHandler] ⌨️ Cmd+C detected, allowing copy');
283281
return;
284282
}
285283

@@ -459,11 +457,6 @@ export class InputHandler {
459457
return;
460458
}
461459

462-
console.log(
463-
'[InputHandler] 📋 Pasting text:',
464-
text.substring(0, 50) + (text.length > 50 ? '...' : '')
465-
);
466-
467460
// Send the text to the terminal
468461
// Note: For bracketed paste mode, we would wrap this in \x1b[200~ ... \x1b[201~
469462
// but for now, send raw text

lib/renderer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('CanvasRenderer', () => {
4444
});
4545

4646
test('has selection colors', () => {
47-
expect(DEFAULT_THEME.selectionBackground).toBe('#264f78');
47+
expect(DEFAULT_THEME.selectionBackground).toBe('rgba(255, 255, 255, 0.3)');
4848
expect(DEFAULT_THEME.selectionForeground).toBe('#d4d4d4');
4949
});
5050
});

lib/renderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const DEFAULT_THEME: Required<ITheme> = {
5252
background: '#1e1e1e',
5353
cursor: '#ffffff',
5454
cursorAccent: '#1e1e1e',
55-
selectionBackground: '#264f78',
55+
selectionBackground: 'rgba(255, 255, 255, 0.3)',
5656
selectionForeground: '#d4d4d4',
5757
black: '#000000',
5858
red: '#cd3131',

lib/selection-manager.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ export class SelectionManager {
202202
canvas.addEventListener('mousedown', (e: MouseEvent) => {
203203
if (e.button === 0) {
204204
// Left click only
205-
console.log('[Selection] 🖱️ mousedown - starting selection');
206205

207206
// CRITICAL: Focus the terminal so it can receive keyboard input
208207
// The canvas doesn't have tabindex, but the parent container does
@@ -222,7 +221,6 @@ export class SelectionManager {
222221
this.selectionStart = cell;
223222
this.selectionEnd = cell;
224223
this.isSelecting = true;
225-
console.log('[Selection] ✅ isSelecting = true');
226224
}
227225
});
228226

@@ -238,7 +236,6 @@ export class SelectionManager {
238236
// Mouse leave - stop selecting if mouse leaves canvas while dragging
239237
canvas.addEventListener('mouseleave', (e: MouseEvent) => {
240238
if (this.isSelecting) {
241-
console.log('[Selection] ⚠️ mouseleave while selecting - but keeping selection active');
242239
// DON'T clear isSelecting here - allow dragging outside canvas
243240
// The document mouseup handler will catch the release
244241
}
@@ -248,9 +245,7 @@ export class SelectionManager {
248245
// This catches mouseup events that happen outside the canvas (common during drag)
249246
this.boundMouseUpHandler = (e: MouseEvent) => {
250247
if (this.isSelecting) {
251-
console.log('[Selection] 🖱️ mouseup - stopping selection');
252248
this.isSelecting = false;
253-
console.log('[Selection] ✅ isSelecting = false');
254249

255250
const text = this.getSelection();
256251
if (text) {
@@ -287,7 +282,6 @@ export class SelectionManager {
287282
const text = this.getSelection();
288283
if (text) {
289284
this.copyToClipboard(text);
290-
console.log('Copied selection to clipboard (via right-click)');
291285
}
292286
}
293287
});
@@ -370,10 +364,7 @@ export class SelectionManager {
370364
navigator.clipboard
371365
.writeText(text)
372366
.then(() => {
373-
console.log(
374-
'✅ Copied to clipboard (Clipboard API):',
375-
text.substring(0, 50) + (text.length > 50 ? '...' : '')
376-
);
367+
// Successfully copied
377368
})
378369
.catch((err) => {
379370
console.error('❌ Clipboard API failed:', err);
@@ -382,7 +373,6 @@ export class SelectionManager {
382373
});
383374
} else {
384375
// Fallback to execCommand for non-secure contexts (like mux.coder)
385-
console.log('💡 Using fallback copy method (Clipboard API requires HTTPS)');
386376
this.copyToClipboardFallback(text);
387377
}
388378
}
@@ -416,12 +406,7 @@ export class SelectionManager {
416406
previouslyFocused.focus();
417407
}
418408

419-
if (successful) {
420-
console.log(
421-
'✅ Copied to clipboard (fallback):',
422-
text.substring(0, 50) + (text.length > 50 ? '...' : '')
423-
);
424-
} else {
409+
if (!successful) {
425410
console.error('❌ Copy failed (both methods)');
426411
}
427412
} catch (err) {

0 commit comments

Comments
 (0)