summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index ed42dfe3..79c45325 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -903,7 +903,6 @@ pub const Tty9p = struct {
};
/// Fold the active pane's column into the one on its right, keeping its panes.
-/// The horizontal mirror of the vertical stacking `New` does.
/// Binds this terminal as a language's REPL, by the language's name as the
/// syntax table has it: an exec made on the body of a file in that
/// language -- a middle click, the execute key, a single word like `ls`
@@ -934,10 +933,11 @@ pub const Repl = struct {
pane.repl = null;
return c.p.setMessage(c.id, "Repl: unbound");
}
- const grammars = @import("grammar_manifest.zig").all;
- const lang: u8 = for (grammars, 0..) |g, i| {
- if (g.exts.len > 0 and std.mem.eql(u8, g.name, arg)) break @intCast(i);
- } else {
+ const manifest = @import("grammar_manifest.zig");
+ const grammars = manifest.all;
+ // Named as a code fence names it: `py`, `Python`, `sh`.
+ const named: ?u8 = if (manifest.byName(arg)) |i| if (grammars[i].exts.len > 0) @intCast(i) else null else null;
+ const lang: u8 = named orelse {
var w = std.Io.Writer.fixed(&buf);
w.print("Repl: no language \"{s}\"; one of", .{arg[0..@min(arg.len, 32)]}) catch {};
for (grammars) |g| if (g.exts.len > 0) w.print(" {s}", .{g.name}) catch break;
@@ -962,6 +962,7 @@ pub const Repl = struct {
}
};
+/// The horizontal mirror of the vertical stacking `New` does.
pub const Joincol = struct {
pub const scope: Scope = .session;
pub fn run(c: Ctx) void {