fix(terminal): replay snapshot history at the PTY size it was drawn for
Opening the terminal panel sometimes showed stray fragments on the prompt row: zsh's end-of-line mark and pieces of the prompt path. The shell had laid its output out for one PTY width, but the client replayed that history into an emulator of another width (an early size estimate, a remount, or a renderer rebuild after fonts loaded). ghostty-web's reflow then left fragments the shell's SIGWINCH redraw never clears. The server now reports the PTY cols/rows in every snapshot, the transport carries them through projections and accepted resizes, and the viewport replays a sized snapshot chunk at that size before returning to the fitted size. The container-based size estimate only seeds newly spawned shells and is no longer sent to a running PTY. Tests cover the sized replay, the store chunk size, the transport projection, and the server snapshot; verified in a production build by reloading with the panel open and switching tabs at a changed width.
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
diff --git a/node_modules/ghostty-web/dist/ghostty-web.js b/node_modules/ghostty-web/dist/ghostty-web.js
|
||||
index 0000000000000000000000000000000000000000..1111111111111111111111111111111111111111 100644
|
||||
--- a/node_modules/ghostty-web/dist/ghostty-web.js
|
||||
+++ b/node_modules/ghostty-web/dist/ghostty-web.js
|
||||
@@ -1538,1 +1538,1 @@
|
||||
- if (A.grapheme_len > 0 && ((k = this.currentBuffer) != null && k.getGraphemeString) ? N = this.currentBuffer.getGraphemeString(g, B) : N = String.fromCodePoint(A.codepoint || 32), this.ctx.fillText(N, w, s), A.flags & e.FAINT && (this.ctx.globalAlpha = 1), A.flags & e.UNDERLINE) {
|
||||
+ if (A.grapheme_len > 0 && ((k = this.currentBuffer) != null && k.getGraphemeString) ? N = this.currentBuffer.getGraphemeString(g, B) : N = A.codepoint == null || A.codepoint <= 0 || A.codepoint > 1114111 || A.codepoint >= 55296 && A.codepoint <= 57343 ? " " : String.fromCodePoint(A.codepoint), this.renderBlockChar(A.codepoint || 32, E, C, I) || this.ctx.fillText(N, w, s), A.flags & e.FAINT && (this.ctx.globalAlpha = 1), A.flags & e.UNDERLINE) {
|
||||
@@ -1557,5 +1557,40 @@
|
||||
}
|
||||
+ renderBlockChar(A, B, g, E) {
|
||||
+ const C = this.metrics.height, I = E / 2, D = C / 2;
|
||||
+ switch (A) {
|
||||
+ case 9600: this.ctx.fillRect(B, g, E, D); return !0;
|
||||
+ case 9601: this.ctx.fillRect(B, g + C * 7 / 8, E, C / 8); return !0;
|
||||
+ case 9602: this.ctx.fillRect(B, g + C * 3 / 4, E, C / 4); return !0;
|
||||
+ case 9603: this.ctx.fillRect(B, g + C * 5 / 8, E, C * 3 / 8); return !0;
|
||||
+ case 9604: this.ctx.fillRect(B, g + D, E, D); return !0;
|
||||
+ case 9605: this.ctx.fillRect(B, g + C * 3 / 8, E, C * 5 / 8); return !0;
|
||||
+ case 9606: this.ctx.fillRect(B, g + C / 4, E, C * 3 / 4); return !0;
|
||||
+ case 9607: this.ctx.fillRect(B, g + C / 8, E, C * 7 / 8); return !0;
|
||||
+ case 9608: this.ctx.fillRect(B, g, E, C); return !0;
|
||||
+ case 9609: this.ctx.fillRect(B, g, E * 7 / 8, C); return !0;
|
||||
+ case 9610: this.ctx.fillRect(B, g, E * 3 / 4, C); return !0;
|
||||
+ case 9611: this.ctx.fillRect(B, g, E * 5 / 8, C); return !0;
|
||||
+ case 9612: this.ctx.fillRect(B, g, I, C); return !0;
|
||||
+ case 9613: this.ctx.fillRect(B, g, E * 3 / 8, C); return !0;
|
||||
+ case 9614: this.ctx.fillRect(B, g, E / 4, C); return !0;
|
||||
+ case 9615: this.ctx.fillRect(B, g, E / 8, C); return !0;
|
||||
+ case 9616: this.ctx.fillRect(B + I, g, I, C); return !0;
|
||||
+ case 9620: this.ctx.fillRect(B, g, E, C / 8); return !0;
|
||||
+ case 9621: this.ctx.fillRect(B + E * 7 / 8, g, E / 8, C); return !0;
|
||||
+ case 9622: this.ctx.fillRect(B, g + D, I, D); return !0;
|
||||
+ case 9623: this.ctx.fillRect(B + I, g + D, I, D); return !0;
|
||||
+ case 9624: this.ctx.fillRect(B, g, I, D); return !0;
|
||||
+ case 9625: this.ctx.fillRect(B, g, I, C); this.ctx.fillRect(B + I, g + D, I, D); return !0;
|
||||
+ case 9626: this.ctx.fillRect(B, g, I, D); this.ctx.fillRect(B + I, g + D, I, D); return !0;
|
||||
+ case 9627: this.ctx.fillRect(B, g, E, D); this.ctx.fillRect(B, g + D, I, D); return !0;
|
||||
+ case 9628: this.ctx.fillRect(B, g, E, D); this.ctx.fillRect(B + I, g + D, I, D); return !0;
|
||||
+ case 9629: this.ctx.fillRect(B + I, g, I, D); return !0;
|
||||
+ case 9630: this.ctx.fillRect(B + I, g, I, D); this.ctx.fillRect(B, g + D, I, D); return !0;
|
||||
+ case 9631: this.ctx.fillRect(B + I, g, I, C); this.ctx.fillRect(B, g + D, I, D); return !0;
|
||||
+ default: return !1;
|
||||
+ }
|
||||
+ }
|
||||
/**
|
||||
* Render cursor
|
||||
*/
|
||||
renderCursor(A, B) {
|
||||
Reference in New Issue
Block a user