Skip to content

Commit 4a845db

Browse files
committed
refactor: remove Phase 3 references from codebase
- Replace 'Phase 3' comments with descriptive names - Update all link detection and rendering comments - Improve code readability without phase-based naming No functional changes - only comment updates
1 parent d4d257a commit 4a845db

File tree

5 files changed

+19
-20
lines changed

5 files changed

+19
-20
lines changed

lib/buffer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,15 +370,15 @@ export class BufferCell implements IBufferCell {
370370

371371
/**
372372
* Get hyperlink ID for this cell (0 = no link)
373-
* Used by link detection system (Phase 3)
373+
* Used by link detection system
374374
*/
375375
getHyperlinkId(): number {
376376
return this.cell.hyperlink_id;
377377
}
378378

379379
/**
380380
* Get the Unicode codepoint for this cell
381-
* Used by link detection system (Phase 3)
381+
* Used by link detection system
382382
*/
383383
getCodepoint(): number {
384384
return this.cell.codepoint;

lib/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export interface IBufferCell {
193193
/** Whether cell has faint/dim style */
194194
isFaint(): number;
195195

196-
// Phase 3: Link detection support
196+
// Link detection support
197197
/** Get hyperlink ID for this cell (0 = no link) */
198198
getHyperlinkId(): number;
199199
/** Get the Unicode codepoint for this cell */

lib/renderer.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class CanvasRenderer {
104104
// Selection manager (for rendering selection overlay)
105105
private selectionManager?: SelectionManager;
106106

107-
// Phase 3: Link rendering state
107+
// Link rendering state
108108
private hoveredHyperlinkId: number = 0;
109109
private previousHoveredHyperlinkId: number = 0;
110110

@@ -309,7 +309,7 @@ export class CanvasRenderer {
309309
}
310310
}
311311

312-
// Phase 3: Track rows with hyperlinks that need redraw when hover changes
312+
// Track rows with hyperlinks that need redraw when hover changes
313313
const hyperlinkRows = new Set<number>();
314314
const hyperlinkChanged = this.hoveredHyperlinkId !== this.previousHoveredHyperlinkId;
315315

@@ -403,7 +403,7 @@ export class CanvasRenderer {
403403
this.renderSelection(dims.cols);
404404
}
405405

406-
// Phase 3: Link underlines are drawn during cell rendering (see renderCell)
406+
// Link underlines are drawn during cell rendering (see renderCell)
407407

408408
// Render cursor (only if we're at the bottom, not scrolled)
409409
if (viewportY === 0 && cursor.visible && this.cursorVisible) {
@@ -523,7 +523,7 @@ export class CanvasRenderer {
523523
this.ctx.stroke();
524524
}
525525

526-
// Phase 3: Draw hyperlink underline
526+
// Draw hyperlink underline
527527
if (cell.hyperlink_id > 0) {
528528
const isHovered = cell.hyperlink_id === this.hoveredHyperlinkId;
529529

@@ -741,21 +741,21 @@ export class CanvasRenderer {
741741
}
742742

743743
/**
744-
* Phase 3: Set the currently hovered hyperlink ID for rendering underlines
744+
* Set the currently hovered hyperlink ID for rendering underlines
745745
*/
746746
public setHoveredHyperlinkId(hyperlinkId: number): void {
747747
this.hoveredHyperlinkId = hyperlinkId;
748748
}
749749

750750
/**
751-
* Phase 3: Get character cell width (for coordinate conversion)
751+
* Get character cell width (for coordinate conversion)
752752
*/
753753
public get charWidth(): number {
754754
return this.metrics.width;
755755
}
756756

757757
/**
758-
* Phase 3: Get character cell height (for coordinate conversion)
758+
* Get character cell height (for coordinate conversion)
759759
*/
760760
public get charHeight(): number {
761761
return this.metrics.height;

lib/scrolling.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ describe('Scroll Events', () => {
620620
expect(positions[2]).toBe(6);
621621
});
622622

623-
// Note: onRender event is deferred to Phase 3 for proper dirty tracking
623+
// Note: onRender event implementation uses dirty tracking for performance
624624
// implementation. Firing it every frame causes performance issues.
625625

626626
test('onCursorMove should fire when cursor moves', async () => {

lib/terminal.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class Terminal implements ITerminalCore {
5959
private selectionManager?: SelectionManager;
6060
private canvas?: HTMLCanvasElement;
6161

62-
// Phase 3: Link detection system
62+
// Link detection system
6363
private linkDetector?: LinkDetector;
6464
private currentHoveredLink?: ILink;
6565
private mouseMoveThrottleTimeout?: number;
@@ -250,7 +250,7 @@ export class Terminal implements ITerminalCore {
250250
}
251251
});
252252

253-
// Phase 3: Initialize link detection system
253+
// Initialize link detection system
254254
this.linkDetector = new LinkDetector(this);
255255

256256
// Register OSC 8 hyperlink provider
@@ -302,7 +302,7 @@ export class Terminal implements ITerminalCore {
302302
// Write directly to WASM terminal (handles VT parsing internally)
303303
this.wasmTerm!.write(data);
304304

305-
// Phase 3: Invalidate link cache (content changed)
305+
// Invalidate link cache (content changed)
306306
this.linkDetector?.invalidateCache();
307307

308308
// Phase 2: Auto-scroll to bottom on new output (xterm.js behavior)
@@ -558,7 +558,7 @@ export class Terminal implements ITerminalCore {
558558
}
559559

560560
// ==========================================================================
561-
// Phase 3: Link Detection Methods
561+
// Link Detection Methods
562562
// ==========================================================================
563563

564564
/**
@@ -725,8 +725,7 @@ export class Terminal implements ITerminalCore {
725725
this.renderer!.render(this.wasmTerm!, false, this.viewportY, this);
726726

727727
// Note: onRender event is intentionally not fired in the render loop
728-
// to avoid performance issues. It will be added in Phase 3 with
729-
// proper dirty tracking. For now, consumers can use requestAnimationFrame
728+
// to avoid performance issues. For now, consumers can use requestAnimationFrame
730729
// if they need frame-by-frame updates.
731730

732731
this.animationFrameId = requestAnimationFrame(loop);
@@ -820,7 +819,7 @@ export class Terminal implements ITerminalCore {
820819
}
821820

822821
/**
823-
* Phase 3: Handle mouse move for link hover detection
822+
* Handle mouse move for link hover detection
824823
* Throttled to avoid blocking scroll events
825824
*/
826825
private handleMouseMove = (e: MouseEvent): void => {
@@ -939,7 +938,7 @@ export class Terminal implements ITerminalCore {
939938
}
940939

941940
/**
942-
* Phase 3: Handle mouse leave to clear link hover
941+
* Handle mouse leave to clear link hover
943942
*/
944943
private handleMouseLeave = (): void => {
945944
// Clear hyperlink underline
@@ -967,7 +966,7 @@ export class Terminal implements ITerminalCore {
967966
};
968967

969968
/**
970-
* Phase 3: Handle mouse click for link activation
969+
* Handle mouse click for link activation
971970
*/
972971
private handleClick = async (e: MouseEvent): Promise<void> => {
973972
// For more reliable clicking, detect the link at click time

0 commit comments

Comments
 (0)