getViewport() returns corrupted data when viewport spans multiple pages
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Description
renderStateGetViewport in the WASM build resolves the viewport top-left position independently for each row using pages.pin(.active). When the viewport spans multiple internal pages, this per-row resolution can produce inconsistent results, leading to corrupted viewport data.
Additionally, scrollbackLimit is passed as a line count but Terminal.init() interprets max_scrollback as bytes, causing the scrollback buffer to be much smaller than intended and making the page-spanning condition occur more frequently.
Symptoms
getScrollbackLength()drops unexpectedly (e.g., 498 → 269) after repeated writesgetViewport()returns rows with content from different terminal lines merged together- Both
getViewport()andgetLine()return the same wrong data - Corruption frequency depends on column width:
- cols=80: OK
- cols=120: CORRUPT
- cols=130: CORRUPT
- cols=140: OK
- cols=160: scrollback drops but viewport may appear OK (merge lands on empty rows)
Root cause
The native Ghostty renderer reads cell data from cached row pins in RenderState.row_data (built during update()), which guarantees consistent page resolution across all viewport rows. The WASM renderStateGetViewport instead calls pages.pin(.active) per-row, which can resolve to different pages inconsistently when the viewport straddles a page boundary.
Reproduction
- Create a terminal at cols=130, rows=39, scrollback=10000
- Repeatedly write ~68 lines of escape-heavy output (SGR 256-color, truecolor, attributes)
- After ~8 repetitions, call
getScrollbackLength()andgetViewport() - Scrollback length will drop and/or viewport rows will contain merged content
Expected behavior
getViewport() should return consistent, correct row data regardless of internal page layout. scrollbackLimit should be interpreted consistently between the JS config and WASM init.
Fix
Draft PR with fix and regression tests: #133
- Ngôn ngữ chính
- TypeScript
- Star
- 3k
- Fork
- 188
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của coder/ghostty-web
-
buffer translateToString()/getChars() return '' for empty cells, collapsing cursor-positioned textĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
coder/ghostty-web#205 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
coder/ghostty-web#204 ·
-
Alt+<printable key> sends the bare key with no ESC prefix (readline/emacs/tmux meta bindings lost)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
coder/ghostty-web#203 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
coder/ghostty-web#199 ·
-
Public buffer getChars and translateToString truncate multi-codepoint graphemesCó thể đã có người làm @schickling-assistant đã nhận 19 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
coder/ghostty-web#200 ·
Tất cả issue của coder/ghostty-web
Issue tương tự
-
ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
xavxyz/bei-shan-lin-shui#57 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] rag: sentence content can cross the reported sentence boundariesCó thể đã có người làm @LJK-ikun đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
platformatic/mcp#361 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
最近文档这个弹窗,左右宽度没有最小宽度限制Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
siyuan-note/siyuan#20799 · 7 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày