diff options
| author | Gabriel Schneider <[email protected]> | 2026-07-31 00:26:12 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-01 15:02:07 -0300 |
| commit | ea228d1b832401db8efe33a5db4099ba41d42509 (patch) | |
| tree | 10a5a7514eca150ba90c188a109c3c604607ef9b /src/file_pane.zig | |
| parent | 19f7322100062b7c1adcde3376063ce6c1d8c72d (diff) | |
| download | pardes-ea228d1b832401db8efe33a5db4099ba41d42509.tar.gz pardes-ea228d1b832401db8efe33a5db4099ba41d42509.zip | |
config.zig: every binding and every piece of Look syntax in one file
Retargeting a key, a mouse chord or a spelling is now an edit to src/config.zig
and nothing else. Three parts in reading order: pardes's own bindings (where a
reader lands), the Look/Exec syntax, then the helix keymap under a banner
saying hxdiff/hxparity are differential suites against real helix, so a key
moved there is a divergence and not a tweak.
The bindings are data a comptime loop can walk, because the builtin index is
going to walk them.
Duplication this cut: is/isC/isA became one hit(key, chords) over ~132 call
sites, and a binding being a LIST collapses the letter-or-arrow chains;
swap_enter_tab is gone, replaced by look_key/exec_key that can point anywhere;
the four focus builtins' h/j/k/l lived hardcoded in two places and is now one
table.
No golden moved.
Diffstat (limited to 'src/file_pane.zig')
| -rw-r--r-- | src/file_pane.zig | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/file_pane.zig b/src/file_pane.zig index 4c02e983..68fea40f 100644 --- a/src/file_pane.zig +++ b/src/file_pane.zig @@ -5,6 +5,7 @@ //! is the pane machinery in pardes.zig, which does not care what kind it is. const std = @import("std"); const pardes = @import("pardes.zig"); +const config = @import("config.zig"); const Pardes = pardes.Pardes; const Pane = pardes.Pane; const File = pardes.File; @@ -115,7 +116,7 @@ pub fn bodyText(arena: std.mem.Allocator, pane: *Pane, f: *File) ![]const u8 { } // horizontal scroll: cut hscroll columns after the gutter if (pane.hscroll > 0) { - const cut_at = row_start + pardes.PREFIX_W; + const cut_at = row_start + config.PREFIX_W; if (out.items.len > cut_at) { const cut = @min(@as(usize, @intCast(pane.hscroll)), out.items.len - cut_at); out.replaceRangeAssumeCapacity(cut_at, cut, &.{}); @@ -140,7 +141,7 @@ pub fn drawGutter(p: *Pardes, pane: *Pane, r: pardes.Rect, tx: u16, tw: u16, bod while (vr < body_h) : (vr += 1) { const on_cursor = @as(i32, vr) == cur_vr; var c: u16 = 0; - while (c < pardes.PREFIX_W and c < tw) : (c += 1) { + while (c < config.PREFIX_W and c < tw) : (c += 1) { const cell = s.at(tx + c, r.y + pardes.BOX_H + vr); cell.default = false; // paints blank gutter rows too if (on_cursor) { @@ -181,13 +182,13 @@ pub fn recolorSyntax(p: *Pardes, pane: *Pane, f: *File, r: pardes.Rect, tx: u16, const line = flines.next() orelse break; const base = @intFromPtr(line.ptr) - @intFromPtr(f.content.ptr); var c: usize = 0; - while (hs + c < line.len and pardes.PREFIX_W + c < tw) : (c += 1) { + while (hs + c < line.len and config.PREFIX_W + c < tw) : (c += 1) { const idx = base + hs + c; if (idx < f.highlight_start) continue; const hidx = idx - f.highlight_start; if (hidx >= f.highlights.len) continue; const ss = synStyle(p, @enumFromInt(f.highlights[hidx])) orelse continue; - const cell = s.at(tx + @as(u16, @intCast(pardes.PREFIX_W + c)), r.y + pardes.BOX_H + vr); + const cell = s.at(tx + @as(u16, @intCast(config.PREFIX_W + c)), r.y + pardes.BOX_H + vr); if (cell.default) continue; cell.style.fg = .{ .rgb = ss.fg }; cell.style.bold = ss.bold; |
