summaryrefslogtreecommitdiff
path: root/core/echo.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-22 20:21:32 -0300
committerGabriel Schneider <[email protected]>2026-11-22 20:21:32 -0300
commit3f250d0f963f375d699f11ffc02b07f2e2cbbbee (patch)
tree4e5a1f577fd3dd247f3643d979868347524ce703 /core/echo.zig
parent34e2d82a322bd3767a8ec62b3a4c0894399e8c04 (diff)
parentc607dc14502a6956bdfa3575bc7363514a7abeb4 (diff)
downloadpardes-3f250d0f963f375d699f11ffc02b07f2e2cbbbee.tar.gz
pardes-3f250d0f963f375d699f11ffc02b07f2e2cbbbee.zip
integration (a base for the terminals' next round, not yet the gathered line): the viewport in the view and the patches in the semantics hash on merge58 with the terminal put back: pardes-raw-tty (`muwnrqro`, on pardes-merge58: a TERM that reaches a session while it leaves its terminal no longer leaves it raw: `Killed.disarm` puts the cooked modes back itself, `leave` calls it last) and pardes-term-join-10's two changes (`xktusoyq` on `qtxssxyk`, on pardes-term-join-9: where a view stands in a terminal's history is the view's (`Pane.scrolled_to`), carried once a confirmed write that moves rows, the wire at 31; build/patches hashed into a replica's semantics); no conflict; core-test 917/1077 (160 skipped), shell-test 1119/1122, pane-test 182/183, term-test 16/16; NOT gated whole: the viewport's gate had one perf count over its budget ("terminal on all" +0.235%), which the next round brings down before this is the gathered line (2026-11-22)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/echo.zig')
-rw-r--r--core/echo.zig13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/echo.zig b/core/echo.zig
index 93b877b8..b1200ca2 100644
--- a/core/echo.zig
+++ b/core/echo.zig
@@ -237,7 +237,7 @@ pub const Echo = struct {
fn predict(e: *Echo, pane: *Pane, kind: Kind, seq: u32) bool {
const state = pane.terminal orelse return false;
const g = Term.grid(state);
- if (Term.modes(state).alternate or g.offset + g.len < g.total or !g.cursor_visible) return false;
+ if (Term.modes(state).alternate or pane.termTop() + g.len < g.total or !g.cursor_visible) return false;
const top = e.tops[e.pane];
const cur: Cursor = e.cursor orelse .{ .x = g.cursor_x, .row = top + g.cursor_y, .seq = 0 };
if (cur.row < top or cur.row - top >= g.len or e.n == max) return false;
@@ -457,17 +457,18 @@ pub const Echo = struct {
const top = e.tops[id];
// Off a prompt, the trust is inferred: underlined, as mosh does.
const flag = !atPrompt(pane);
+ const shown = pane.termTop();
const at = struct {
- fn f(sb_: @TypeOf(sb), pan: u16, h: u16, top_: u64, row: u64) ?u16 {
+ fn f(sb_: @TypeOf(sb), shown_: usize, pan: u16, h: u16, top_: u64, row: u64) ?u16 {
if (row < top_ or row - top_ >= sb_.len) return null;
const screen_row = sb_.total - sb_.len + (row - top_);
- if (screen_row < sb_.offset + pan) return null;
- const y = screen_row - sb_.offset - pan;
+ if (screen_row < shown_ + pan) return null;
+ const y = screen_row - shown_ - pan;
return if (y < h) @intCast(y) else null;
}
}.f;
for (e.cells[0..e.n]) |cell| {
- const y = at(sb, pane.pan, body_h, top, cell.row) orelse continue;
+ const y = at(sb, shown, pane.pan, body_h, top, cell.row) orelse continue;
if (cell.x >= tw) continue;
const dst = s.at(tx + cell.x, body_y + y);
// Typed text continues the text before it (mosh's heuristic).
@@ -484,7 +485,7 @@ pub const Echo = struct {
}
if (!active or pane.focus != .body) return;
const cur = e.cursor orelse return;
- const y = at(sb, pane.pan, body_h, top, cur.row) orelse return;
+ const y = at(sb, shown, pane.pan, body_h, top, cur.row) orelse return;
if (cur.x < tw) s.cursor = .{ .x = tx + cur.x, .y = body_y + y };
}
};