summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pardes.zig56
1 files changed, 15 insertions, 41 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index f637e78a..38ba6451 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -2670,8 +2670,6 @@ pub fn pathUnder(a: []const u8, b: []const u8) bool {
const tutor_text = @embedFile("tutor.txt");
-// ---- theme ----
-
const boot_buffer =
\\x selects a line, Tab runs it. 0x optional.
\\
@@ -2711,8 +2709,6 @@ test "every line of the board's boot buffer renders whole" {
try std.testing.expect(std.mem.indexOf(u8, boot_buffer, "\nGpio\n") != null);
}
-// ---- the boundary types ----
-
test "Tab N draws every pane's tab N cells wide and clicks count past it; bare Tab says the width; the ctl read and a Dump keep it" {
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .cols = 60, .rows = 12 });
@@ -4102,8 +4098,6 @@ pub const Pardes = struct {
/// (File.DiffOutput).
diff_output: panes.File.DiffOutput = .{},
- /// The message row's entry points, called from everywhere as
- /// `p.setMessage(...)`; they live with the rest of it in Messages.zig.
/// What the replay digest leaves out (src/walk.zig): what drawing
/// keeps, what is recomputed, and what only the session that performs
/// effects has.
@@ -4132,6 +4126,8 @@ pub const Pardes = struct {
.len = .{ .{ "jumps", "njumps" }, .{ "look_src", "n_look_src" }, .{ "leader_keys", "leader_n" }, .{ "col_x", "ncol" }, .{ "col_w", "ncol" }, .{ "session_dir", "session_dir_len" } },
};
+ /// The message row's entry points, called from everywhere as
+ /// `p.setMessage(...)`; they live with the rest of it in Messages.zig.
pub const setStatus = Messages.setStatus;
pub const setMessage = Messages.setMessage;
pub const reportError = Messages.reportError;
@@ -4335,7 +4331,6 @@ pub const Pardes = struct {
p.store.flush(p, false);
}
- /// A file pane's path and dot, for the recent list (0 when none).
/// Whether `path` is one Recent keeps: a file on this host's disk, not
/// the served tree's (`/virtual/`) nor a name never saved.
pub fn recentKeeps(path: []const u8) bool {
@@ -4372,6 +4367,7 @@ pub const Pardes = struct {
return pane.pdfPath();
}
+ /// A file pane's path and dot, for the recent list (0 when none).
fn recentDot(pane: *const Pane) ?struct { path: []const u8, line: u32, col: u32, aline: u32 = 0, acol: u32 = 0 } {
const f = pane.file orelse return null;
if (f.output != null) return null;
@@ -4783,7 +4779,6 @@ pub const Pardes = struct {
return layout.columnBySerial(p, p.active_column);
}
- /// The column the keyboard is in: its tag's, or its pane's.
/// DECSET 1004: a program that asked is told `CSI I` when its pane
/// takes the keyboard (the active pane, its body, the window focused)
/// and `CSI O` when it gives it up, to another pane, a tag or header,
@@ -5047,9 +5042,6 @@ pub const Pardes = struct {
false;
}
- /// Something changed the core without going through `update` -- a watched
- /// file reloading under it, a theme file rewritten on disk. `pump` draws
- /// only when it has a reason to, and this is the reason.
/// A view of its own for a new client (a second window, a terminal
/// `pardes --attach`ed), as the live one is laid out; null at
/// views.max. Not live until `toView`.
@@ -5127,6 +5119,9 @@ pub const Pardes = struct {
views.to(p, k);
}
+ /// Something changed the core without going through `update` -- a watched
+ /// file reloading under it, a theme file rewritten on disk. `pump` draws
+ /// only when it has a reason to, and this is the reason.
pub fn invalidate(p: *Pardes) void {
const taped = tape.enter(p, .invalidate);
defer tape.leave(p, taped);
@@ -5897,8 +5892,6 @@ pub const Pardes = struct {
}
}
- // ---- tag + selection text (chord sources) ----
-
pub fn paneIdOf(p: *const Pardes, pane: *const Pane) ?usize {
return std.mem.findScalar(?*const Pane, &p.panes, pane);
}
@@ -5952,11 +5945,6 @@ pub const Pardes = struct {
}
}
- /// Answers the question pane `id` asks on its notice band, logged as
- /// `ask <serial> <what> <choices>`: Del's side (`k` above, `j` below) or
- /// the REPL to send to (its letter). Null, or a choice not offered,
- /// takes the question back. A key answers it, or `answer` on the pane's
- /// ctl; false when the pane asks nothing.
/// The choices the question pane `id` asks offers, space-separated
/// (`k j`, `a b`), or null when it asks none.
pub fn questionChoices(p: *const Pardes, id: usize, buf: []u8) ?[]const u8 {
@@ -5978,9 +5966,12 @@ pub const Pardes = struct {
}
}
- /// Answers the pane's question: a choice it offers, else (null, or a
- /// key it does not offer) takes it back. The log says which, as
- /// `answer <serial> <choice|->`, after the `ask` it answers.
+ /// Answers the question pane `id` asks on its notice band (logged as
+ /// `ask <serial> <what> <choices>`): Del's side (`k` above, `j` below)
+ /// or the REPL to send to (its letter). A choice it offers answers it;
+ /// null, or one it does not offer, takes it back. A key answers it, or
+ /// `answer` on the pane's ctl, and the log says which, as `answer
+ /// <serial> <choice|->`; false when the pane asks nothing.
pub fn answerQuestion(p: *Pardes, id: usize, choice: ?u8) bool {
const asked = p.panes[id] orelse return false;
var offered: [64]u8 = undefined;
@@ -6346,12 +6337,6 @@ pub const Pardes = struct {
}
}
- // ---- helix-modal normal mode ----
-
- // ---- selection pipe (`|`): visible prompt, async shell, atomic edit ----
-
- // ---- search (`/`, Find, n/N): results into an output buffer, look the rows ----
-
/// Where pardes started: the directory of what runs from a header.
pub fn sessionDir(p: *Pardes) []const u8 {
if (p.session_dir_len) |n| return p.session_dir[0..n];
@@ -6876,14 +6861,9 @@ pub const Pardes = struct {
}
}
- // ---- n/N: the walk over look-able text ----
-
+ /// The rows n/N's walk over look-able text reads before it stops (look.zig).
pub const max_look_rows = 8192;
- // ---- edit operations (d / c / y / p) ----
-
- // ---- dumb undo/redo: whole-state snapshots, one per edit op ----
-
pub fn acknowledgePanelPresentation(p: *Pardes, tracks: []const animation.Track) void {
const taped = tape.enter(p, .{ .acknowledge_panel_presentation = tracks });
defer tape.leave(p, taped);
@@ -6933,8 +6913,6 @@ pub const Pardes = struct {
p.setMessage(p.active, std.fmt.bufPrint(&buf, "WindowOpacity: {s}", .{reason[0..@min(reason.len, 240)]}) catch "WindowOpacity: compositor rejected the request");
}
- // ---- doc panes ----
-
pub fn openTutorView(p: *Pardes, id: usize) !*Pane {
const content = try p.gpa.dupe(u8, tutor_text);
errdefer p.gpa.free(content);
@@ -6969,10 +6947,6 @@ pub const Pardes = struct {
return pane;
}
- // ---- the ONE dispatcher: look (right/Enter) and execute (middle/Tab) ----
-
- // ---- dump / load (acme-style: `pardes -l state.zon` restores a session) ----
-
/// Close a pane; its rows go to `to`, or where layout.absorbVWeight
/// sends them when that is null. Focus on it follows its rows to the
/// pane that grew into them. A column outlives its panes, as acme's
@@ -7261,8 +7235,6 @@ pub const Pardes = struct {
look.focusPaneLine(p, j.pane, .{ .line = j.line, .col = j.col }, .center);
}
- /// Recompute geometry, push grid-size changes to each emulator + pty, fire
- /// deferred greetings. The mirror of the prototype's loop epilogue.
/// The rows pane `id`'s tag takes at its width, wrapped as `sync` wraps
/// it: what a placement must leave it above its body rows.
pub fn wantedTagRows(p: *Pardes, id: usize) u16 {
@@ -7278,6 +7250,8 @@ pub const Pardes = struct {
return @intCast(@max(BOX_H, @min(shown.rows(), MAX_TAG_ROWS)));
}
+ /// Recompute geometry, push grid-size changes to each emulator and pty,
+ /// fire deferred greetings.
pub fn sync(p: *Pardes) void {
while (p.unplaced.findFirstSet()) |id| {
p.unplaced.unset(id);