fix: respond to PTY cursor queries

This commit is contained in:
Peter Steinberger
2026-01-17 07:05:15 +00:00
parent a85ddf258c
commit 5dc87a2ed4
4 changed files with 42 additions and 1 deletions

14
src/agents/pty-dsr.ts Normal file
View File

@@ -0,0 +1,14 @@
const DSR_PATTERN = /\x1b\[\??6n/g;
export function stripDsrRequests(input: string): { cleaned: string; requests: number } {
let requests = 0;
const cleaned = input.replace(DSR_PATTERN, () => {
requests += 1;
return "";
});
return { cleaned, requests };
}
export function buildCursorPositionResponse(row = 1, col = 1): string {
return `\x1b[${row};${col}R`;
}