fix(coding-agent/modes): gated scratch folder icon on stripWorkPrefix

The status-line path segment was selecting theme.icon.scratchFolder for scratch directories regardless of opts.stripWorkPrefix, while the CHANGELOG promised both behaviors honor the option. Icon selection now uses the same opts.stripWorkPrefix !== false gate as the scratch path stripping, so disabling stripWorkPrefix keeps the regular folder icon even when the project directory is inside a scratch root.
This commit is contained in:
can1357
2026-05-15 17:49:14 +02:00
parent c4672f11af
commit b489200933
3 changed files with 19 additions and 1 deletions
@@ -124,6 +124,22 @@ describe("status line path segment", () => {
}
});
it("keeps the folder icon for scratch paths when stripWorkPrefix is disabled", () => {
const scratchDir = fs.mkdtempSync(path.join(os.tmpdir(), "omp-status-line-scratch-noprefix-"));
try {
setProjectDir(scratchDir);
const ctx = createPathContext();
ctx.options.path = { ...ctx.options.path, stripWorkPrefix: false };
const rendered = renderSegment("path", ctx);
expect(rendered.visible).toBe(true);
expect(rendered.content).toContain(theme.icon.folder);
expect(rendered.content).not.toContain(theme.icon.scratchFolder);
} finally {
fs.rmSync(scratchDir, { recursive: true, force: true });
}
});
it("keeps the folder icon for paths outside any scratch root", () => {
const projectsRoot = path.join(os.homedir(), "Projects");
fs.mkdirSync(projectsRoot, { recursive: true });