diff options
Diffstat (limited to 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index 47ebf8fa..aa2c252c 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -4180,6 +4180,8 @@ pub const Boot = enum { document, /// a Look that found nothing: reported, not opened missing, + /// `pardes -`: stdin's text in a +Pager pane, as `vim -` shows it + stdin, /// the firmware's boot buffer, the only pane a board has embedded, /// the bare tty startup: one shell in raw tty mode, with an empty text @@ -4196,6 +4198,7 @@ pub const Boot = enum { if (opts.boot) |named| return named; if (opts.file != null) return .document; if (opts.missing != null) return .missing; + if (opts.stdin_text != null) return .stdin; if (comptime platform == .esp32p4) return .embedded; if (opts.tty_only) return .tty_shell; // ponytail: 1 and 3 are the only shell counts anyone asked for @@ -4215,6 +4218,8 @@ pub const Options = struct { file: ?[]const u8 = null, file_line: usize = 0, missing: ?struct { word: []const u8, dir: []const u8 } = null, + /// `pardes -`: stdin, its escapes stripped, for a +Pager pane at boot. + stdin_text: ?[]const u8 = null, tty_toggle: u21 = config.tty_toggle_default, /// load a dump of another instance instead of spawning shells (acme -l) load_path: ?[]const u8 = null, @@ -4626,6 +4631,17 @@ pub const Pardes = struct { _ = try panes.Output.open(p, 0, missing.dir, .errors, "", content); p.oneColumn(); }, + .stdin => { + const content = try gpa.dupe(u8, opts.stdin_text.?); + errdefer gpa.free(content); + const dir = p.sessionDir(); + const shown = try panes.Output.open(p, 0, dir, .{ .cmd = .New }, "", content); + // Named +Pager, as `pardes -` inside a session names its pane. + const named = try std.fs.path.join(gpa, &.{ dir, "+Pager" }); + gpa.free(shown.file.?.path); + shown.file.?.path = named; + p.oneColumn(); + }, .embedded => { const content = try p.gpa.dupe(u8, boot_buffer); errdefer p.gpa.free(content); |
