summaryrefslogtreecommitdiff
path: root/core/body_layer.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 18:47:01 -0300
committerGabriel Schneider <[email protected]>2026-11-21 21:34:04 -0300
commit0d7879195a05b450877d2bf6bd625c01fbfbef8a (patch)
tree78ee67251d7919335c2a7ac5e06afe2bbf158f24 /core/body_layer.zig
parentb7e843256982f5a22954d103bb40264daf2bb758 (diff)
downloadpardes-0d7879195a05b450877d2bf6bd625c01fbfbef8a.tar.gz
pardes-0d7879195a05b450877d2bf6bd625c01fbfbef8a.zip
layers: ghost rows (slice 5): with `Changes` shown, what the file no longer has is drawn where it stood, rows of their own with no number and dimmer ink (`jj.Ghost`, kept with jj's answers, `Changes.ghosts` in `at` order, their text in `Changes.ghost_text` beside the hunks' removed lines): a line a pinned change took away whole, red across, in the line numbers' grey, placed by carrying the place it was taken from through the later pins' hunks into the shown text (`jj.carried`), and each pin's description after its last line (`id title author age`, the id's first four letters, the author's first name, the age short with no "ago", in its lane's colour, the author and age grey; the age is of the wall clock jj's answer carries, read where jj runs, an input as jj's answer is), the descriptions of blocks that close just above a place first and newest first, then the lines taken away there, then the descriptions of pins that have only those; a ghost row carries its own pin's lane and those of the line above that run on below it or close at or after it (`jj.ghostLanes`); the view's geometry takes the rows (`File.fillBody`'s ghosted instance, only while this view shows the changes and there are some: a ghost row's `wrap_col` is `-1 - ` its index, its `wrap_line` the line it stands before; `Pane.ghosts`/`ghost_text`, derived, set by `jj.showGhosts` each step while shown and as an answer lands), so the rows below move down in this view alone (another view with the lanes hidden is unmoved: tested); `wrapAt` says `ghost` and answers the line below at its start, so the cursor steps over them (`j` from the line above lands on the line below), selection, search hits, places and tables do not paint them, the line numbers skip them, a page ends before one; a Look (B3) on one opens its line in the revision it came from (`path@id-:line` for a line taken away, `path@id:line` for a description: `jj.lookGhost`); `]g` and `[g` (helix's, free in pardes's map: `goto_change`) go to the next and the previous change's first line (`jj.nextChange`); edits carry them as the lines' values (`jj.splice`: a ghost row stands before the line it stood before; one before a line taken out stands before the line after what took its place); in a terminal and in a window (tested both); round 3's lanes test reads each line's row through the view's map; tests: what the rows show (text, numbers, lanes by pin, grounds, inks) in both frontends and the other view unmoved; the cursor, the selection, `]g`/`[g` and a Look; the rows riding through two deletions with a client replaying them equal
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/body_layer.zig')
-rw-r--r--core/body_layer.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/body_layer.zig b/core/body_layer.zig
index 78b8e0b9..817176bb 100644
--- a/core/body_layer.zig
+++ b/core/body_layer.zig
@@ -88,6 +88,7 @@ fn paintSourceSelection(p: *Pardes, s: *Surface, pane: *Pane, r: Rect, rows: []c
var visible: i32 = 0;
while (visible < @as(i32, r.h -| pane.tag_rows)) : (visible += 1) {
const source = pane.wrapAt(p.settings.tab, visible);
+ if (source.ghost) continue;
const line = edit.pointerSourceLine(pane, terminal_lines, source.line);
const start = @min(line.len, @as(usize, @intCast(@max(0, source.at))));
const next = pane.wrapAt(p.settings.tab, visible + 1);
@@ -280,7 +281,7 @@ fn drawWrapMarkers(
const marker_fg = p.chromeTheme().lineno;
var row: u16 = 0;
while (row + 1 < pane.wrap_n and row + 1 < body_h) : (row += 1) {
- if (pane.wrap_line[row + 1] != pane.wrap_line[row]) continue;
+ if (pane.wrap_line[row + 1] != pane.wrap_line[row] or pane.wrap_col[row] < 0) continue;
s.set(tx + tw - 1, body_y + row, config.wrap_marker, .{
.fg = .{ .rgb = marker_fg },
.bg = pane_bg,
@@ -406,7 +407,7 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane
var vr: i32 = 0;
while (vr + @as(i32, pane.tag_rows) < @as(i32, body_bottom)) : (vr += 1) {
const w = pane.wrapAt(p.settings.tab, vr);
- if (w.line < bnd.lo_row or w.line > bnd.hi_row) continue;
+ if (w.line < bnd.lo_row or w.line > bnd.hi_row or w.ghost) continue;
const visible_line = modal.lineSlice(body, @intCast(vr));
// Only the visible columns are measured: a selection that
// starts before this row's first column starts at it, and