MCPcopy Create free account
hub / github.com/coder/ghostty-web / loop

Method loop

lib/terminal.ts:1095–1118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1093 */
1094 private startRenderLoop(): void {
1095 const loop = () => {
1096 if (!this.isDisposed && this.isOpen) {
1097 // Render using WASM's native dirty tracking
1098 // The render() method:
1099 // 1. Calls update() once to sync state and check dirty flags
1100 // 2. Only redraws dirty rows when forceAll=false
1101 // 3. Always calls clearDirty() at the end
1102 this.renderer!.render(this.wasmTerm!, false, this.viewportY, this, this.scrollbarOpacity);
1103
1104 // Check for cursor movement (Phase 2: onCursorMove event)
1105 // Note: getCursor() reads from already-updated render state (from render() above)
1106 const cursor = this.wasmTerm!.getCursor();
1107 if (cursor.y !== this.lastCursorY) {
1108 this.lastCursorY = cursor.y;
1109 this.cursorMoveEmitter.fire();
1110 }
1111
1112 // Note: onRender event is intentionally not fired in the render loop
1113 // to avoid performance issues. For now, consumers can use requestAnimationFrame
1114 // if they need frame-by-frame updates.
1115
1116 this.animationFrameId = requestAnimationFrame(loop);
1117 }
1118 };
1119 loop();
1120 }
1121

Callers

nothing calls this directly

Calls 3

renderMethod · 0.80
getCursorMethod · 0.65
fireMethod · 0.45

Tested by

no test coverage detected