summaryrefslogtreecommitdiff
path: root/src/config.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/config.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/config.zig')
-rw-r--r--src/config.zig123
1 files changed, 102 insertions, 21 deletions
diff --git a/src/config.zig b/src/config.zig
index d6ea7358..a92aabb6 100644
--- a/src/config.zig
+++ b/src/config.zig
@@ -32,6 +32,8 @@ pub const leader_path = paths: {
var table = std.EnumArray(Builtin, ?[]const u8).initDefault(@as(?[]const u8, undecided), .{
.Help = &[_]u8{leader_help},
.Hover = "lk",
+ .Def = null, // gd
+ .Refs = null, // gr
.Rename = "lr",
.CodeAction = "la",
.SelectRefs = "lh",
@@ -41,14 +43,18 @@ pub const leader_path = paths: {
.WsDiagnostics = "lD",
.Lspinfo = "li",
.Lspwhy = "lw",
+ .Callstack = "lb",
.Callers = "lc",
.Callees = "lC",
.Supertypes = "lt",
.Subtypes = "lT",
+ .LookNext = "jn",
+ .LookPrev = "jp",
.Del = "d",
.DelAbove = null,
.DelBelow = null,
.Filter = null,
+ .Diff = null,
.Mode = null,
.Togglettymode = null,
.Collapse = null,
@@ -62,6 +68,9 @@ pub const leader_path = paths: {
.Putall = null,
.Incl = null,
.Tab = null,
+ .CallstackDepth = null,
+ .CallstackLayout = null,
+ .CallstackCorners = null,
.Zerox = null,
.ClipYank = "y",
.ClipYankMain = "Y",
@@ -87,6 +96,7 @@ pub const leader_path = paths: {
.BootShell = null,
.LookWord = null,
.DirLook = null,
+ .DiffLook = null,
.Pager = null,
.PagerColor = null,
.TermImages = null,
@@ -109,10 +119,11 @@ pub const leader_path = paths: {
.Ascii = "ta",
.Dump = "sd",
.Restore = "sr",
- .Left = "wh",
- .Down = "wj",
- .Up = "wk",
- .Right = "wl",
+ .Left = null,
+ .Down = null,
+ .Up = null,
+ .Right = null,
+ .Window = "w",
.Back = "jo",
.Forward = "ji",
.Last = "jj",
@@ -143,6 +154,7 @@ pub const leader_path = paths: {
table.set(.JumpTrail, null);
table.set(.ChipShadow, null);
table.set(.ThumbFlash, null);
+ table.set(.ProgramEsc, null);
if (builtins.capabilities.lift) table.set(.Lift, null);
table.set(.Motion, null);
table.set(.InactiveDim, null);
@@ -201,7 +213,7 @@ pub const leader_path = paths: {
test "Space-k is unbound while Exit, Kill and other k chords remain available" {
try std.testing.expect(leader_path.get(.Kill) == null);
try std.testing.expectEqualStrings("q", leader_path.get(.Exit).?);
- try std.testing.expectEqualStrings("wk", leader_path.get(.Up).?);
+ try std.testing.expectEqualStrings("w", leader_path.get(.Window).?);
try std.testing.expectEqualStrings("lk", leader_path.get(.Hover).?);
try std.testing.expectEqualStrings("d", leader_path.get(.Del).?);
for (pardes.builtin_rows) |row| if (row.cmd == .Kill) {
@@ -253,7 +265,8 @@ pub const select_button: Mouse.Button = .left;
pub const look_cmd: Builtin = .Look;
pub const exec_cmd: Builtin = .Exec;
-// Ctrl-w remains available when a terminal owns printable keys.
+// Ctrl-w: window mode (layout.windowKey), as SPC w; on a header it
+// prefixes h/j/k/l, a move between the headers.
pub const window_prefix: []const Chord = &.{.{ .cp = 'w', .ctrl = true }};
pub const window_keys = [_]struct { letter: Chord, arrow: Chord, cmd: Builtin }{
@@ -273,8 +286,9 @@ pub const jump_keys = [_]struct { chord: Chord, cmd: Builtin }{
};
/// Shift-Esc: the Esc nothing swallows. In every mode and pane it does what
-/// Esc does from normal mode, back to the previous pane (Last); a raw
-/// terminal's program never sees it. Ctrl-b alone toggles raw.
+/// Esc does from normal mode, back to the previous pane (Last); in a raw
+/// terminal plain Esc does it and Shift-Esc is the program's Esc, unless
+/// ProgramEsc is on. Ctrl-b alone toggles raw.
pub const back_out: []const Chord = &.{.{ .cp = Key.escape, .shift = true }};
pub const tty_toggle_default: u21 = 'b';
@@ -301,6 +315,16 @@ pub const topbar_str = "Newcol Joincol Find Grep Help Changelog Tutor Dump Theme
pub const pane_builtins_str = "Tty Collapse Del";
pub const pdf_pane_builtins_str = "Tty PdfSections PdfTint Collapse Del";
pub const file_pane_builtins_str = "Save Tty Collapse Del";
+/// After a file's, on one a language server speaks for.
+pub const lsp_pane_builtins_str = "Def Refs";
+/// A diff's (a .diff, a .patch, a +Pager holding one): Diff.
+pub const diff_pane_builtins_str = "Save Tty Diff Collapse Del";
+/// A +Pager's (`pardes -`): Filter, as a terminal's.
+pub const pager_pane_builtins_str = "Save Tty Filter Collapse Del";
+/// A +Pager holding a diff (`git show`): Diff too.
+pub const pager_diff_pane_builtins_str = "Save Tty Filter Diff Collapse Del";
+/// A +Diff's: Diff again, the diff it stacks as text.
+pub const diff_view_builtins_str = "Save Tty Diff Collapse Del";
pub const terminal_pane_builtins_str = "Tty Save Mode Filter Collapse Del";
pub const command_pane_builtins_str = "Kill Save Collapse Del";
/// A directory pane's (Dir.zig): Get reads it again, as acme's does.
@@ -317,6 +341,8 @@ pub const command_line: []const Chord = &.{.{ .cp = ':' }};
pub const search: []const Chord = &.{.{ .cp = '/' }};
pub const search_next: []const Chord = &.{.{ .cp = 'n' }};
pub const search_prev: []const Chord = &.{.{ .cp = 'N' }};
+pub const search_selection: []const Chord = &.{.{ .cp = '*', .alt = true }};
+pub const search_selection_word: []const Chord = &.{.{ .cp = '*' }};
pub const pipe_selection: []const Chord = &.{.{ .cp = '|' }};
pub const pipe_selection_to: []const Chord = &.{.{ .cp = '|', .alt = true }};
pub const insert_output: []const Chord = &.{.{ .cp = '!' }};
@@ -500,6 +526,7 @@ pub const unsaved_buffer = "+Unsaved";
pub const themes_buffer = "+Themes";
pub const fonts_buffer = "+Fonts";
pub const pdf_sections_buffer = "+PdfSections";
+pub const diff_buffer = "+Diff";
pub const pdf_links_buffer = "+Links";
pub const hover_buffer = "+Hover";
pub const lsp_buffer = "+Lsp";
@@ -561,7 +588,8 @@ pub const goto_line_down: []const Chord = &.{.{ .cp = 'j' }};
pub const goto_line_up: []const Chord = &.{.{ .cp = 'k' }};
pub const goto_column: []const Chord = &.{.{ .cp = '|' }};
pub const goto_view_top: []const Chord = &.{.{ .cp = 't' }};
-pub const goto_view_center: []const Chord = &.{.{ .cp = 'c' }};
+// gc opens Callstack; it no longer moves the cursor to the viewport center.
+pub const goto_view_center: []const Chord = &.{};
pub const goto_view_bottom: []const Chord = &.{.{ .cp = 'b' }};
pub const goto_last_modification: []const Chord = &.{.{ .cp = '.' }};
pub const goto_word: []const Chord = &.{.{ .cp = 'w' }};
@@ -572,6 +600,7 @@ pub const goto_declaration: []const Chord = &.{.{ .cp = 'D' }};
pub const goto_type_definition: []const Chord = &.{.{ .cp = 'y' }};
pub const goto_implementation: []const Chord = &.{.{ .cp = 'i' }};
pub const goto_references: []const Chord = &.{.{ .cp = 'r' }};
+pub const goto_callstack: []const Chord = &.{.{ .cp = 'c' }};
pub const match_bracket: []const Chord = &.{.{ .cp = 'm' }};
pub const match_inside = 'i';
@@ -739,6 +768,9 @@ pub const Runtime = struct {
/// T7: in a terminal, a pane's scroll thumb brightens as it scrolls and
/// fades back (truecolor terminals).
thumb_flash: bool = false,
+ /// In a raw terminal, Esc goes to the program and Shift-Esc backs out
+ /// (off, the default: Esc backs out and Shift-Esc is the program's).
+ program_esc: bool = false,
/// How long a message stays after the key or click that dismisses it.
message_linger_ms: u16 = 800,
/// How long its fall into the row takes, easing out (ยง8.1: arriving,
@@ -794,6 +826,10 @@ pub const Runtime = struct {
/// A directory looked at: `pane`, acme's, a pane listing it (Dir.zig);
/// `terminal`, what pardes did before, `ls` in a terminal there.
dir_look: DirLook = .pane,
+ /// A .diff or .patch looked at (a look, `pardes FILE`, `--wait`):
+ /// `hunks`, a +Diff stacking its hunks (hunks.zig); `text`, the file
+ /// itself, as pardes showed it before. Diff goes from one to the other.
+ diff_look: DiffLook = .hunks,
/// What a terminal's shell pages through (host_io.ChildEnv): `pardes`,
/// PAGER and GIT_PAGER set to `pardes -`, a +Pager pane, where the
/// user's environment set neither; `off`, the environment as it is.
@@ -812,17 +848,23 @@ pub const Runtime = struct {
/// acme's Tab: a tab's width in cells, in every pane (config.tab_now
/// is what the drawing and the column arithmetic read).
tab: u16 = tab_width,
+ callstack_layout: CallstackLayout = .stacked,
+ callstack_corners: CallstackCorners = .rounded,
+ callstack_depth: u8 = @import("lsp/lsp.zig").callstack_default_depth,
pub const ShaderAnimation = enum { off, on, always };
pub const Placement = enum { acme, pardes };
pub const BootShell = enum { keep, replace };
pub const LookWord = enum { search, list };
pub const DirLook = enum { pane, terminal };
+ pub const DiffLook = enum { hunks, text };
pub const Pager = enum { pardes, off };
pub const TermImages = enum { real, petscii };
pub const JumpScope = enum { file, all };
+ pub const CallstackLayout = enum { @"inline", stacked };
+ pub const CallstackCorners = @import("lsp/lsp.zig").CallstackCorners;
/// A setting that is one of a few words, each an enum field of Runtime.
- pub const Choice = enum { placement, boot_shell, look_word, dir_look, pager, term_images, jump_scope };
+ pub const Choice = enum { placement, boot_shell, look_word, dir_look, diff_look, pager, term_images, jump_scope, callstack_layout, callstack_corners };
/// shadow: a soft drop shadow. rim: a light hairline along the top of
/// the focused pane's tag rows. auto: a shadow on a light page; on a
@@ -987,7 +1029,7 @@ pub const Runtime = struct {
/// The message timings a setting word sets, each in milliseconds.
pub const MessageTime = enum { linger, fall, dissolve };
- pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, pager_color, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax, jump_trail, chip_shadow, thumb_flash };
+ pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, pager_color, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax, jump_trail, chip_shadow, thumb_flash, program_esc };
/// A bundled post pass, a Shadertoy file in shaders/post/: the CRT, and
/// G4's bloom, vignette and grain (docs/effects.md).
pub const Scene = enum { crt, bloom, vignette, grain };
@@ -1010,6 +1052,7 @@ pub const Runtime = struct {
inactive_dim,
grip_width,
tab,
+ callstack_depth,
transition: animation.Transition,
scene: Scene,
/// A Shadertoy file into the post chain or out of it; `off` empties
@@ -1054,6 +1097,7 @@ pub const Runtime = struct {
.{ .word = "JumpTrail", .action = .{ .toggle = .jump_trail }, .doc = "In a terminal, a jump of the cursor leaves a short trail that fades, on or off." },
.{ .word = "ChipShadow", .action = .{ .toggle = .chip_shadow }, .doc = "In a terminal, a notice chip casts a cell's shadow right and down, on or off." },
.{ .word = "ThumbFlash", .action = .{ .toggle = .thumb_flash }, .doc = "In a terminal, a pane's scroll thumb brightens as it scrolls and fades back, on or off." },
+ .{ .word = "ProgramEsc", .action = .{ .toggle = .program_esc }, .doc = "In a raw terminal, Esc goes to the program and Shift-Esc backs out, on; off (the default) swaps them." },
.{ .word = "Lift", .action = .lift, .availability = .lift, .doc = "How the focused pane stands off the page: off, shadow, rim or auto." },
.{ .word = "Motion", .action = .motion, .doc = "How animations move: off, crisp, smooth, bouncy or playful." },
.{ .word = "InactiveDim", .action = .inactive_dim, .doc = "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off." },
@@ -1088,11 +1132,15 @@ pub const Runtime = struct {
.{ .word = "Placement", .action = .{ .choice = .placement }, .doc = "Where a new pane goes: acme, as makenewwindow does, or pardes, the older rules." },
.{ .word = "BootShell", .action = .{ .choice = .boot_shell }, .doc = "A document dropped where a lone untouched shell stands: keep the shell, or replace it." },
.{ .word = "LookWord", .action = .{ .choice = .look_word }, .doc = "A plain word looked at: search selects its next place in the pane, list lists every place in a +Search." },
+ .{ .word = "DiffLook", .action = .{ .choice = .diff_look }, .doc = "A .diff or .patch looked at: hunks, a +Diff stacking its hunks, or text, the file itself; Diff goes from one to the other." },
.{ .word = "DirLook", .action = .{ .choice = .dir_look }, .doc = "A directory looked at: pane, a pane listing it as acme's directory window, or terminal, ls in a terminal there." },
.{ .word = "Pager", .action = .{ .choice = .pager }, .doc = "What a terminal's commands page through: pardes, a +Pager pane (pardes -), or off, the environment's own; for terminals started after it." },
.{ .word = "PagerColor", .action = .{ .toggle = .pager_color }, .doc = "A +Pager keeps its program's colours, on or off; for the next text paged." },
.{ .word = "TermImages", .action = .{ .choice = .term_images }, .doc = "How a new terminal draws its program's kitty graphics: real, as pixels where it can, or petscii, as glyph art." },
.{ .word = "JumpScope", .action = .{ .choice = .jump_scope }, .doc = "What Back and Forward keep to: file, the focused pane's file until it runs out that way, or all, every place in order." },
+ .{ .word = "CallstackLayout", .action = .{ .choice = .callstack_layout }, .doc = "Callstack snippets below their locations (stacked, the default) or beside them (inline); bare, it switches layouts. Applies to the next Callstack query." },
+ .{ .word = "CallstackCorners", .action = .{ .choice = .callstack_corners }, .doc = "Callstack tree corners: rounded (the default) or square; bare, it switches styles. Applies to the next Callstack query." },
+ .{ .word = "CallstackDepth", .action = .callstack_depth, .doc = "Caller levels collected by Callstack, 1 through 64; default 8. Bare, it says the current limit." },
.{ .word = "Tab", .action = .tab, .doc = "A tab's width in cells, 1 through 16, in every pane; bare, it says the width." },
};
@@ -1294,6 +1342,12 @@ pub const Runtime = struct {
if (percent < 50 or percent > 300) return false;
state.grip_width = percent;
},
+ .callstack_depth => {
+ const text = std.mem.trim(u8, argument orelse return false, " \t\r\n");
+ const depth = std.fmt.parseInt(u8, text, 10) catch return false;
+ if (depth < 1 or depth > @import("lsp/lsp.zig").callstack_max_depth) return false;
+ state.callstack_depth = depth;
+ },
.tab => {
const text = std.mem.trim(u8, argument orelse return false, " \t\r\n");
const width = std.fmt.parseInt(u16, text, 10) catch return false;
@@ -1336,6 +1390,7 @@ pub const Runtime = struct {
.inactive_dim, .window_opacity, .window_blur => "0-100 (a percentage)",
.grip_width => "50-300 (a percentage)",
.tab => "1-16 (cells)",
+ .callstack_depth => "1-64 (levels)",
.tagline_size => std.fmt.comptimePrint("{d}-{d} (a percentage)", .{ tagline_percent_min, tagline_percent_max }),
.message_ms => std.fmt.comptimePrint("0-{d} (milliseconds)", .{message_ms_max}),
.shell => "a path of at most 255 bytes; bare, $SHELL, else /bin/sh",
@@ -1498,6 +1553,7 @@ pub const Runtime = struct {
try out.print("# {s} unsupported\n", .{setting.word}),
.motion => try out.print("{s} {s}\n", .{ setting.word, @tagName(state.motion) }),
.inactive_dim => try out.print("{s} {d}\n", .{ setting.word, state.inactive_dim }),
+ .callstack_depth => try out.print("{s} {d}\n", .{ setting.word, state.callstack_depth }),
.tab => try out.print("{s} {d}\n", .{ setting.word, state.tab }),
.grip_width => if (setting.enabled(context.capabilities))
try out.print("{s} {d}\n", .{ setting.word, state.grip_width })
@@ -1787,14 +1843,18 @@ pub const Runtime = struct {
.boot_shell => "replace",
.look_word => "list",
.dir_look => "terminal",
+ .diff_look => "text",
.pager => "off",
.term_images => "petscii",
.jump_scope => "all",
+ .callstack_layout => "inline",
+ .callstack_corners => "square",
},
.lift => "rim",
.motion => "playful",
.inactive_dim => "35",
.grip_width => "200",
+ .callstack_depth => "16",
.tab => "8",
else => null,
};
@@ -1824,6 +1884,7 @@ pub const Runtime = struct {
.jump_trail => "JumpTrail on\n",
.chip_shadow => "ChipShadow on\n",
.thumb_flash => "ThumbFlash on\n",
+ .program_esc => "ProgramEsc on\n",
},
.shell => "Shell fish\n",
.tagline_size => "TaglineSize 73\n",
@@ -1862,14 +1923,18 @@ pub const Runtime = struct {
.boot_shell => "BootShell replace\n",
.look_word => "LookWord list\n",
.dir_look => "DirLook terminal\n",
+ .diff_look => "DiffLook text\n",
.pager => "Pager off\n",
.term_images => "TermImages petscii\n",
.jump_scope => "JumpScope all\n",
+ .callstack_layout => "CallstackLayout inline\n",
+ .callstack_corners => "CallstackCorners square\n",
},
.lift => "Lift rim\n",
.motion => "Motion playful\n",
.inactive_dim => "InactiveDim 35\n",
.grip_width => "GripWidth 200\n",
+ .callstack_depth => "CallstackDepth 16\n",
.tab => "Tab 8\n",
.theme, .font => unreachable,
};
@@ -2114,10 +2179,12 @@ pub const User = struct {
defer gpa.free(one_path);
const bytes = try std.Io.Dir.cwd().readFileAlloc(io, one_path, gpa, .limited(4096));
defer gpa.free(bytes);
- const source = try gpa.dupeZ(u8, bytes);
+ const source = try gpa.dupeSentinel(u8, bytes, 0);
defer gpa.free(source);
- const parsed = try std.zon.parse.fromSliceAlloc(Sample, gpa, source, null, .{});
- defer std.zon.parse.free(gpa, parsed);
+ var arena: std.heap.ArenaAllocator = .init(gpa);
+ defer arena.deinit();
+ var diagnostics: std.zon.parse.Diagnostics = undefined;
+ const parsed = try std.zon.parse.fromSlice(Sample, .{ .gpa = gpa, .arena = arena.allocator(), .source = source, .diagnostics = &diagnostics });
try std.testing.expectEqualStrings("one", parsed.name);
try std.testing.expectEqual([3]u8{ 1, 2, 3 }, parsed.rgb);
}
@@ -2183,25 +2250,26 @@ const doc_typ = struct {
fn hasChordField(T: type) bool {
if (@typeInfo(T) != .array or @typeInfo(@typeInfo(T).array.child) != .@"struct") return false;
- for (@typeInfo(@typeInfo(T).array.child).@"struct".fields) |f| if (f.type == Chord) return true;
+ for (@typeInfo(@typeInfo(T).array.child).@"struct".field_types) |F| if (F == Chord) return true;
return false;
}
/// Bound somewhere in this file: a binding, a prefix or a key list.
fn bound(c: Chord) bool {
const config = @import("config.zig");
- inline for (@typeInfo(config).@"struct".decls) |d| {
- const v = @field(config, d.name);
+ inline for (@typeInfo(config).@"struct".decl_names) |d| {
+ const v = @field(config, d);
const T = @TypeOf(v);
if (T == []const Chord) {
for (v) |b| if (same(b, c)) return true;
} else if (T == comptime_int or T == u21 or T == u8) {
// a prefix or a bare key; only the tty toggle carries Ctrl
- const plain = !c.alt and !c.shift and (!c.ctrl or comptime std.mem.indexOf(u8, d.name, "toggle") != null);
+ const plain = !c.alt and !c.shift and (!c.ctrl or comptime std.mem.indexOf(u8, d, "toggle") != null);
if (plain and v >= 0x20 and v < 0x7f and v == c.cp) return true;
} else if (comptime hasChordField(T)) {
- for (v) |e| inline for (@typeInfo(@TypeOf(e)).@"struct".fields) |f|
- if (f.type == Chord and same(@field(e, f.name), c)) return true;
+ const info = @typeInfo(@TypeOf(v[0])).@"struct";
+ for (v) |e| inline for (info.field_names, info.field_types) |name, F|
+ if (F == Chord and same(@field(e, name), c)) return true;
}
}
return false;
@@ -2235,7 +2303,7 @@ const doc_typ = struct {
if (w.end > 0) w.writeByte(' ') catch return false;
w.writeAll(x[0 .. std.mem.indexOfScalar(u8, x, '+') orelse x.len]) catch return false;
}
- const tags = [_][]const u8{ topbar_str, @import("tagline.zig").column_tag_default, pane_builtins_str, pdf_pane_builtins_str, file_pane_builtins_str, terminal_pane_builtins_str, command_pane_builtins_str, dir_pane_builtins_str };
+ const tags = [_][]const u8{ topbar_str, @import("tagline.zig").column_tag_default, pane_builtins_str, pdf_pane_builtins_str, file_pane_builtins_str, diff_pane_builtins_str, pager_pane_builtins_str, pager_diff_pane_builtins_str, diff_view_builtins_str, terminal_pane_builtins_str, command_pane_builtins_str, dir_pane_builtins_str };
for (tags) |d| if (std.mem.eql(u8, d, w.buffered())) return true;
return false;
}
@@ -2447,3 +2515,16 @@ test "reference.typ's #fstree is the tree the session serves, file for file" {
};
if (drift) return error.FsTreeDrift;
}
+
+test "CallstackDepth is bounded and keeps the last valid runtime limit" {
+ var state: Runtime = .{};
+ try std.testing.expectEqual(@as(u8, 8), state.callstack_depth);
+ for ([_][]const u8{ "1", "8", "16", "64" }) |value| {
+ try std.testing.expect(Runtime.apply(&state, Runtime.find("CallstackDepth").?, value));
+ try std.testing.expectEqual(try std.fmt.parseInt(u8, value, 10), state.callstack_depth);
+ }
+ for ([_][]const u8{ "0", "65", "256", "-1", "eight", "" }) |value| {
+ try std.testing.expect(!Runtime.apply(&state, Runtime.find("CallstackDepth").?, value));
+ try std.testing.expectEqual(@as(u8, 64), state.callstack_depth);
+ }
+}