Draw full-screen programs in ConPTY panes properly

ConPTY writes on from a full row with an erase in between, counting on
the wrap staying pending; the emulator drops it, as xterm does, so the
next row's first character landed on the last column. It showed in Git's
vim, both in a local editor pane and a Windows server's terminal, so the
erase is dropped for either. Also note that search on a Windows server
needs the Visual C++ runtime.
This commit is contained in:
Callum Alpass committed 2026-11-04 16:45:03 +11:00
1 parent 53ceb6a8c5
commit 4adaab66e9
4 files changed
+45 -7

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import { describe, expect, test } from "bun:test";
import { keepConptyWrap } from "../src/ui/terminalAttach.ts";
describe("keepConptyWrap", () => {
test("drops the erase between a full row and the next one's text", () => {
expect(keepConptyWrap("~ \x1b[K~ \x1b[K~")).toBe("~ ~ ~");
});
test("sees past styling and cursor visibility", () => {
expect(keepConptyWrap("~ \x1b[K\x1b[m\x1b[1m\x1b[7mstatus")).toBe("~ \x1b[m\x1b[1m\x1b[7mstatus");
expect(keepConptyWrap("~ \x1b[K\x1b[?25l~")).toBe("~ \x1b[?25l~");
});
test("keeps an erase that ends a row", () => {
for (const data of ["short\x1b[K", "short\x1b[K\r\nnext", "short\x1b[K\x1b[3;1Hnext", "short\x1b[K\x1b[?25l\x1b[14C"]) expect(keepConptyWrap(data)).toBe(data);
});
test("leaves other erases alone", () => {
expect(keepConptyWrap("a\x1b[2Kb\x1b[1Kc")).toBe("a\x1b[2Kb\x1b[1Kc");
});
});