Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ <h3>📚 Available Commands</h3>
foreground: '#d4d4d4',
cursor: '#ffffff',
cursorAccent: '#000000',
selectionBackground: '#264f78',
selectionBackground: 'rgba(255, 255, 255, 0.3)',
selectionForeground: '#ffffff',
black: '#000000',
red: '#cd3131',
Expand Down
7 changes: 0 additions & 7 deletions lib/input-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/renderer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
Expand Down
2 changes: 1 addition & 1 deletion lib/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const DEFAULT_THEME: Required<ITheme> = {
background: '#1e1e1e',
cursor: '#ffffff',
cursorAccent: '#1e1e1e',
selectionBackground: '#264f78',
selectionBackground: 'rgba(255, 255, 255, 0.3)',
selectionForeground: '#d4d4d4',
black: '#000000',
red: '#cd3131',
Expand Down
19 changes: 2 additions & 17 deletions lib/selection-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -222,7 +221,6 @@ export class SelectionManager {
this.selectionStart = cell;
this.selectionEnd = cell;
this.isSelecting = true;
console.log('[Selection] ✅ isSelecting = true');
}
});

Expand All @@ -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
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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)');
}
}
});
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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) {
Expand Down