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:
@@ -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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user