summaryrefslogtreecommitdiff
path: root/core/Core.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Core.zig')
-rw-r--r--core/Core.zig10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/Core.zig b/core/Core.zig
index 0b602ba2..84a58427 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -326,6 +326,9 @@ word_look: bool = false,
/// have no directory of their own: it runs in the session's
/// (`sessionDir`), as acme's row and column tags do.
exec_header: bool = false,
+/// The running word is Root's (`SPC :`, `SPC f F`, `SPC f G`): it runs at
+/// the project's root above its directory (execDir, Pick.open).
+exec_root: bool = false,
session_dir: [limits.host_path_cap]u8 = undefined,
/// A spawn's directory too long for the effect's inline buffer, by pane
/// slot: the effect then carries none, and perform gives the host this.
@@ -539,6 +542,7 @@ pub const replica = .{
// `init` makes them between any two steps.
"multi_first", "multi_stop", "multi_index",
"multi_count", "exec_depth", "exec_column",
+ "exec_root",
// How this process was started, and the last dump it made for
// its host to write: a session loaded elsewhere has its own.
"opts", "dump_out", "dump_export",
@@ -1902,10 +1906,10 @@ fn processDir(buf: *[limits.host_path_cap]u8) ?[]const u8 {
}
/// The directory a word run from pane `id`'s text or tag runs in, or,
-/// from a header, the session's.
+/// from a header, the session's; Root's, the project's root above it.
pub fn execDir(p: *Pardes, id: usize) []const u8 {
- if (p.exec_header) return p.sessionDir();
- return paneDir(p.panes[id] orelse return p.sessionDir());
+ const dir = if (p.exec_header or p.panes[id] == null) p.sessionDir() else paneDir(p.panes[id].?);
+ return if (p.exec_root) pardes.Pick.workTree(p, dir) else dir;
}
pub const SavePath = Effect.Buf(effect_path_cap);