summaryrefslogtreecommitdiff
path: root/src/body_layer.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-22 09:50:43 -0300
committerGabriel Schneider <[email protected]>2026-10-22 10:03:24 -0300
commita8b457a306a4442975210bcac3f04b56513c61c3 (patch)
tree6e2026ecb15da2fb919a0202f5d8b38e3b36a595 /src/body_layer.zig
parenta8a1499bdffffc5b6919e24ec957e92fabaf003b (diff)
parent7e9d2c4169245072265b483ffaa6aa05f23f08d3 (diff)
downloadpardes-a8b457a306a4442975210bcac3f04b56513c61c3.tar.gz
pardes-a8b457a306a4442975210bcac3f04b56513c61c3.zip
Merge: Def/Refs, the diff viewer, Helix n/N, Callstack, Zig 0.17, Window mode and the terminal cwd fix onto 0.24
The docs keep both sides: 0.24's Ctrl-i fallbacks and typed ls with this line's Window mode, raw Esc and Helix n/N wording. The CHANGELOG's unreleased entries go above 0.24, Def/Refs and the context rows among them. cheatsheet-a4.pdf rendered again; .scratch/ ignored. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/body_layer.zig')
-rw-r--r--src/body_layer.zig42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/body_layer.zig b/src/body_layer.zig
index b24bd6ed..2aa8e5f8 100644
--- a/src/body_layer.zig
+++ b/src/body_layer.zig
@@ -113,8 +113,8 @@ fn paintSourceSelection(p: *Pardes, s: *Surface, pane: *Pane, r: Rect, rows: []c
const lo = @max(start, row.lo);
const hi = @min(end, row.hi);
if (lo >= hi) continue;
- var col = prefix + @as(i32, @intCast(panes.File.rawDisplayCol(line[start..], lo - start)));
- const last = if (row.to_edge and hi == end) @as(i32, width) else prefix + @as(i32, @intCast(panes.File.rawDisplayCol(line[start..], hi - start)));
+ var col = prefix + source.pad + @as(i32, @intCast(panes.File.rawDisplayCol(line[start..], lo - start)));
+ const last = if (row.to_edge and hi == end) @as(i32, width) else prefix + source.pad + @as(i32, @intCast(panes.File.rawDisplayCol(line[start..], hi - start)));
while (col < last and col < width) : (col += 1) {
const cell = s.at(tx + @as(u16, @intCast(col)), body_y + @as(u16, @intCast(visible)));
cell.default = false;
@@ -399,14 +399,14 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane
(if (pane.file != null)
panes.File.displayOffset(pane, w.line, w.at, bnd.lo_col)
else
- panes.File.lineDisplayOffset(visible_line, @intCast(@max(0, w.at)), @intCast(@max(0, bnd.lo_col)))) + vpfx
+ panes.File.lineDisplayOffset(visible_line, @intCast(@max(0, w.at)), @intCast(@max(0, bnd.lo_col)))) + vpfx + w.pad
else
- vpfx;
+ vpfx + w.pad;
const cend: i32 = if (w.line == bnd.hi_row and @as(usize, @intCast(@max(0, bnd.hi_col))) < past_view)
(if (pane.file != null)
panes.File.displayEndOffset(pane, w.line, w.at, bnd.hi_col)
else
- panes.File.lineDisplayEndOffset(visible_line, @intCast(@max(0, w.at)), @intCast(@max(0, bnd.hi_col)))) + vpfx
+ panes.File.lineDisplayEndOffset(visible_line, @intCast(@max(0, w.at)), @intCast(@max(0, bnd.hi_col)))) + vpfx + w.pad
else
@as(i32, tw) - 1;
var col: i32 = @max(cstart, vpfx);
@@ -432,7 +432,7 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane
modal.lineSlice(body, @intCast(@max(0, cw.row))),
@intCast(@max(0, cw.at)),
@intCast(@max(0, sr.col)),
- )) + vpfx;
+ )) + vpfx + cw.pad;
if (crow >= pane.tag_rows and crow < @as(i32, body_bottom) and ccol >= vpfx and ccol < tw) {
const cell = s.at(tx + @as(u16, @intCast(ccol)), body_y + @as(u16, @intCast(crow - pane.tag_rows)));
cell.default = false;
@@ -455,7 +455,7 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane
const row: i32 = @intCast(pos.row);
const wp = pane.wrapRow(row, @intCast(pos.col));
const cx = if (pane.file != null)
- @as(i32, panes.File.gutterWidth(pane)) + panes.File.displayOffset(pane, row, wp.at, @intCast(pos.col))
+ @as(i32, panes.File.gutterWidth(pane)) + wp.pad + panes.File.displayOffset(pane, row, wp.at, @intCast(pos.col))
else
panes.File.lineDisplayOffset(modal.lineSlice(flat, pos.row), @intCast(@max(0, wp.at)), pos.col);
if (wp.row >= 0 and wp.row < body_h and cx >= 0 and cx < tw)
@@ -478,20 +478,20 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane
// Off the view, the cursor is not measured (its column may be
// millions of bytes along a line whose start is shown).
if (cwp.row >= 0 and prow < body_bottom and !pastView(pane, body, crow, cwp.row, cwp.at, ccol, tw)) {
- // Files store source-byte columns; the Surface stores display
- // cells, so account for every expanded tab before the cursor.
- const cx = if (pane.file != null)
- @as(i32, panes.File.gutterWidth(pane)) + panes.File.displayOffset(pane, crow, cwp.at, ccol)
- else if (pane.body.cur_pinned)
- panes.File.lineDisplayOffset(
- modal.lineSlice(body, @intCast(@max(0, cwp.row))),
- @intCast(@max(0, cwp.at)),
- @intCast(@max(0, ccol)),
- )
- else
- ccol;
- if (prow >= pane.tag_rows and cx >= 0 and prow < body_bottom and cx < tw)
- s.cursor = .{ .x = tx + @as(u16, @intCast(cx)), .y = body_y + @as(u16, @intCast(prow - pane.tag_rows)), .bar = pane.body.mode == .insert };
+ // Files store source-byte columns; the Surface stores display
+ // cells, so account for every expanded tab before the cursor.
+ const cx = if (pane.file != null)
+ @as(i32, panes.File.gutterWidth(pane)) + cwp.pad + panes.File.displayOffset(pane, crow, cwp.at, ccol)
+ else if (pane.body.cur_pinned)
+ panes.File.lineDisplayOffset(
+ modal.lineSlice(body, @intCast(@max(0, cwp.row))),
+ @intCast(@max(0, cwp.at)),
+ @intCast(@max(0, ccol)),
+ )
+ else
+ ccol;
+ if (prow >= pane.tag_rows and cx >= 0 and prow < body_bottom and cx < tw)
+ s.cursor = .{ .x = tx + @as(u16, @intCast(cx)), .y = body_y + @as(u16, @intCast(prow - pane.tag_rows)), .bar = pane.body.mode == .insert };
}
} else if (panes.terminal.visibleCursor(pane)) |cur| {
if (cur.y + pane.tag_rows < body_bottom and cur.x < tw)