summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:42:22 -0300
committerGabriel Schneider <[email protected]>2026-11-04 23:42:22 -0300
commit5a927d1a4e92750bc0d48994df2c2e552d669b01 (patch)
tree7301943c90d813a561400468967e774c39c6d376 /src/exec.zig
parent63e6ceefc7ab33e31c9d4f83387183e44089e443 (diff)
downloadpardes-5a927d1a4e92750bc0d48994df2c2e552d669b01.tar.gz
pardes-5a927d1a4e92750bc0d48994df2c2e552d669b01.zip
exec, look: pointerOperand, isFile and langOf, one-line wrappers with one caller or four, go to their callers (pardes.zig's recentKeeps asks kindOf), as do the unused themes, BOX_H and pathUnder and look's second alias of fs.zig; missedLine and lookPdfPage take their one type, not anytype; isRecentList drops a .cmd = .Recent origin nothing makes; executeFrom's doc moves off isComment, and a comment look.zig said twice is said once
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/exec.zig b/src/exec.zig
index 3fc03038..de31624a 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -13,7 +13,6 @@ const normal = @import("normal.zig");
const edit = @import("edit.zig");
const body_layer = @import("body_layer.zig");
const colors = @import("colors.zig");
-const themes = colors.themes;
const builtins = @import("builtins.zig");
const config = @import("config.zig");
const grammars = @import("grammar_manifest.zig").all;
@@ -27,7 +26,6 @@ const hosted = pardes.hosted;
const fonts = pardes.fonts;
const Pane = panes.Pane;
const MAX_COLS = pardes.MAX_COLS;
-const BOX_H = pardes.BOX_H;
const Builtin = pardes.Builtin;
const Key = pardes.Key;
const sel_slot = pardes.sel_slot;
@@ -103,10 +101,6 @@ pub const PointerOperand = struct {
expanded: ?Pane.Sel = null,
};
-pub fn pointerOperand(p: *Pardes, pane: *Pane, clicked: Pane.Sel) PointerOperand {
- return operandAt(p, pane, clicked, true, true);
-}
-
/// The body's explicit selection, else what a look at its cursor takes.
pub fn currentOperand(p: *Pardes, pane: *Pane) ?[]const u8 {
if (pane.file == null and !pane.isTerminal()) return null;
@@ -458,11 +452,6 @@ pub fn missingDir(p: *Pardes, dir: []const u8) bool {
return kindOf(local) != .directory;
}
-/// Whether `path` is a plain file on this host, the turn out while it asks.
-pub fn isFile(path: []const u8) bool {
- return kindOf(path) == .file;
-}
-
/// What `path` is on this host, null when it is not there; the turn out
/// while it asks (it may be inside a mount this editor serves).
pub fn kindOf(path: []const u8) ?std.Io.File.Kind {
@@ -514,12 +503,6 @@ pub fn evictLonePristineTty(p: *Pardes, col: usize, keep_id: usize) void {
// a word like `ls` too. The tag's words, `Exec` by name and a command word
// `@`...`` still run as commands.
-/// A file pane's language, as grammar_manifest names it, by its index.
-pub fn langOf(pane: *const Pane) ?u8 {
- const f = pane.file orelse return null;
- return @intCast(@import("grammar_manifest.zig").byPath(f.path) orelse return null);
-}
-
/// A bound REPL whose program is there to take input: a command pane's
/// while its command runs; an interactive terminal's while a program, not
/// the shell, has its tty (the host's `tty_taken`) -- a python3 left with
@@ -557,7 +540,8 @@ fn routeToRepl(p: *Pardes, from: usize, text: []const u8) Routed {
sendToRepl(p, from, from, text);
return .{ .sent = from };
}
- const lang = langOf(src) orelse return .none;
+ // The file's language, by its grammar_manifest index.
+ const lang: u8 = @intCast(@import("grammar_manifest.zig").byPath((src.file orelse return .none).path) orelse return .none);
// Every REPL bound for the language whose program still runs: one
// whose program exited is skipped, in the question and in the choice.
var bound: [26]usize = undefined;
@@ -710,9 +694,6 @@ pub fn execute(p: *Pardes, id: usize, txt: []const u8) ?usize {
return executeFrom(p, id, txt, false);
}
-/// `execute` for text a gesture took from `id`'s body when `from_body`:
-/// such text may be a bound REPL's. Run by name (`Exec ...`, whose line
-/// comes back through `execute`) or written as a command word, never.
/// A line that starts with `#` is a comment, as in a shell: it runs as
/// nothing, silently, wherever a line runs (exec, a ctl, the init file),
/// so DumpConfig's report reads back as configuration whole.
@@ -721,6 +702,9 @@ pub fn isComment(line: []const u8) bool {
return t.len > 0 and t[0] == '#';
}
+/// `execute` for text a gesture took from `id`'s body when `from_body`:
+/// such text may be a bound REPL's. Run by name (`Exec ...`, whose line
+/// comes back through `execute`) or written as a command word, never.
pub fn executeFrom(p: *Pardes, id: usize, txt: []const u8, from_body: bool) ?usize {
if (isComment(commandText(txt))) return null;
// An empty window runs its session words, and a command line in the