Remove debug logging from terminal component

- Clean up console.log statements added for debugging
- Keep the mobile horizontal fit improvements
- Maintain explicit font styling for measurement accuracy

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Mario Zechner 2025-06-17 23:57:12 +02:00
parent d1e98a6f81
commit 4077977194

View file

@ -145,10 +145,7 @@ export class Terminal extends LitElement {
}
private measureCharacterWidth(): number {
if (!this.container) {
console.log('measureCharacterWidth: no container, returning default 8px');
return 8;
}
if (!this.container) return 8;
// Create temporary element with same styles as terminal content, attached to container
const measureEl = document.createElement('div');
@ -167,16 +164,12 @@ export class Terminal extends LitElement {
const testContent = testString.repeat(repeatCount).substring(0, this.cols);
measureEl.textContent = testContent;
console.log(`measureCharacterWidth: measuring ${this.cols} chars with fontSize=${this.fontSize}px, testContent length: ${testContent.length}`);
// Attach to container so it inherits all the proper CSS context
this.container.appendChild(measureEl);
const measureRect = measureEl.getBoundingClientRect();
const actualCharWidth = measureRect.width / this.cols;
this.container.removeChild(measureEl);
console.log(`measureCharacterWidth: measureRect.width=${measureRect.width}px, cols=${this.cols}, calculated charWidth=${actualCharWidth}px`);
return actualCharWidth;
}
@ -189,8 +182,6 @@ export class Terminal extends LitElement {
const containerHeight = this.container.clientHeight;
const targetCharWidth = containerWidth / this.cols;
console.log(`Horizontal fit: container ${containerWidth}x${containerHeight}px, target charWidth=${targetCharWidth}px for ${this.cols} cols`);
// Calculate fontSize needed for target character width
// Use current font size as starting point and measure actual character width
const currentCharWidth = this.measureCharacterWidth();
@ -198,16 +189,12 @@ export class Terminal extends LitElement {
const calculatedFontSize = this.fontSize * scaleFactor;
const newFontSize = Math.max(4, Math.min(32, calculatedFontSize));
console.log(`Horizontal fit: currentCharWidth=${currentCharWidth}px, scaleFactor=${scaleFactor}, calculatedFontSize=${calculatedFontSize}px, clampedFontSize=${newFontSize}px`);
this.fontSize = newFontSize;
// Also fit rows to use full container height with the new font size
const lineHeight = this.fontSize * 1.2;
const fittedRows = Math.max(1, Math.floor(containerHeight / lineHeight));
console.log(`Horizontal fit: lineHeight=${lineHeight}px, fittedRows=${fittedRows}`);
// Update both actualRows and the terminal's actual row count
this.actualRows = fittedRows;
this.rows = fittedRows;
@ -216,16 +203,11 @@ export class Terminal extends LitElement {
if (this.terminal) {
this.terminal.resize(this.cols, this.rows);
}
console.log(
`Horizontal fit: FINAL fontSize ${this.fontSize}px, ${this.cols}x${this.rows} in ${containerWidth}x${containerHeight}px`
);
} else {
// Normal mode: just calculate how many rows fit in the viewport
const containerHeight = this.container.clientHeight;
const lineHeight = this.fontSize * 1.2;
this.actualRows = Math.max(1, Math.floor(containerHeight / lineHeight));
console.log(`Viewport fits ${this.actualRows} rows`);
}
this.requestUpdate();