Fix SGR mouse release button + reflow wrapped lines on resize
- SGR (1006) release events now carry the same button number as the
press ('m' suffix marks release); the legacy 'button 3 = release'
is only used for X10/UTF8 encodings. ncurses apps (htop etc.) could
not pair press+release before, so clicks were ignored while scroll
(press-only wheel events) worked
- Each window keeps its recent raw PTY output (capped at 512 KB); on
resize the history is replayed into a fresh parser at the new width
so long lines re-wrap correctly instead of keeping old break points
- Integration: release-button and reflow checks, 33/33 passing
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -198,6 +198,11 @@ def main():
|
||||
text = disp.frame_text(timeout=5.0, contains="[<0;")
|
||||
check("musklick forwardas som SGR till PTY", "[<0;" in text,
|
||||
f"frame-text: {text[-200:]!r}")
|
||||
# Släppet ska bära SAMMA knappnummer med 'm'-suffix (SGR), inte
|
||||
# legacy-koden 3 — annars registrerar ncurses-appar inga klick.
|
||||
text = disp.frame_text(timeout=5.0, contains="[<0;4;3m")
|
||||
check("mus-släpp forwardas med korrekt knappnummer", "[<0;4;3m" in text,
|
||||
f"frame-text: {text[-200:]!r}")
|
||||
|
||||
# Scroll ska också forwardas (SGR-knapp 64/65)
|
||||
disp.send(mouse_event("ScrollDown", cx, cy))
|
||||
@@ -247,6 +252,30 @@ def main():
|
||||
f"frame-tail: {text[-200:]!r}")
|
||||
app.send({"type": "close_window", "window_id": rz_open["id"]})
|
||||
|
||||
# ── 4b3. Reflow: långa rader radbryts om efter resize ────────────
|
||||
long = "A" * 90
|
||||
app.send({"type": "spawn_window",
|
||||
"command": f"printf '{long}\\n'; exec cat",
|
||||
"request_id": "w-reflow"})
|
||||
rf_open = app.recv_until("window_opened")
|
||||
disp.frame_text(timeout=5.0, contains="AAAA")
|
||||
app.send({"type": "list_windows", "request_id": "lrf"})
|
||||
wrf = next(w for w in app.recv_until("window_list")["windows"]
|
||||
if w["id"] == rf_open["id"])
|
||||
# 90 A på 80 kolumner bred terminal → raden är bruten
|
||||
text = disp.frame_text(timeout=2.0)
|
||||
check("lång rad är bruten före resize", long not in text)
|
||||
# dra nedre högra hörnet så innehållet blir ≥ 90 kolumner brett
|
||||
cx0, cy0 = wrf["x"] + wrf["width"] - 1, wrf["y"] + wrf["height"] - 1
|
||||
grow = 94 - (wrf["width"] - 2)
|
||||
disp.send(mouse_event({"Down": "Left"}, cx0, cy0))
|
||||
disp.send(mouse_event({"Drag": "Left"}, min(cx0 + grow, 99), cy0))
|
||||
disp.send(mouse_event({"Up": "Left"}, min(cx0 + grow, 99), cy0))
|
||||
text = disp.frame_text(timeout=5.0, contains=long)
|
||||
check("raden radbryts om (reflow) efter resize", long in text,
|
||||
f"bredd efter: {wrf['width']}+{grow}")
|
||||
app.send({"type": "close_window", "window_id": rf_open["id"]})
|
||||
|
||||
# ── 4c. Scrollback: mushjul utan mus-tracking scrollar historiken ─
|
||||
app.send({"type": "spawn_window",
|
||||
"command": "seq 1 200; exec cat",
|
||||
|
||||
Reference in New Issue
Block a user