fix(app): stabilize native terminal rendering

Scale custom glyph paths in measured cell coordinates so box-drawing runs fill their cells on Android. Debounce daemon resize claims at the terminal pane boundary so keyboard layout animation sends only the settled dimensions.
This commit is contained in:
Mohamed Boudra
2026-08-04 18:43:46 +02:00
parent dac255cb99
commit adf508a1c8
6 changed files with 212 additions and 45 deletions
@@ -0,0 +1,47 @@
export interface TerminalResizeRequest {
rows: number;
cols: number;
shouldClaim: boolean;
forceClaim?: boolean;
}
export function createTerminalResizeDebouncer(input: {
delayMs: number;
emit: (resize: TerminalResizeRequest) => void;
}): {
schedule: (resize: TerminalResizeRequest) => void;
cancel: () => void;
} {
let timeout: ReturnType<typeof setTimeout> | null = null;
let pending: TerminalResizeRequest | null = null;
const cancel = () => {
if (timeout !== null) {
clearTimeout(timeout);
timeout = null;
}
pending = null;
};
return {
schedule: (resize) => {
pending = {
...resize,
shouldClaim: (pending?.shouldClaim ?? false) || resize.shouldClaim,
forceClaim: (pending?.forceClaim ?? false) || resize.forceClaim || undefined,
};
if (timeout !== null) {
clearTimeout(timeout);
}
timeout = setTimeout(() => {
timeout = null;
const resizeToEmit = pending;
pending = null;
if (resizeToEmit) {
input.emit(resizeToEmit);
}
}, input.delayMs);
},
cancel,
};
}