Fix shell-integration-features being ignored when shell-integration is none

This commit is contained in:
Bryan Lee
2025-01-14 16:37:28 +08:00
parent 72d085525b
commit 8ee4deddb4
2 changed files with 17 additions and 4 deletions

View File

@@ -114,9 +114,7 @@ pub fn setup(
};
// Setup our feature env vars
if (!features.cursor) try env.put("GHOSTTY_SHELL_INTEGRATION_NO_CURSOR", "1");
if (!features.sudo) try env.put("GHOSTTY_SHELL_INTEGRATION_NO_SUDO", "1");
if (!features.title) try env.put("GHOSTTY_SHELL_INTEGRATION_NO_TITLE", "1");
try setupFeatures(env, features);
return result;
}
@@ -138,6 +136,17 @@ test "force shell" {
}
}
/// Setup shell integration feature environment variables without
/// performing full shell integration setup.
pub fn setupFeatures(
env: *EnvMap,
features: config.ShellIntegrationFeatures,
) !void {
if (!features.cursor) try env.put("GHOSTTY_SHELL_INTEGRATION_NO_CURSOR", "1");
if (!features.sudo) try env.put("GHOSTTY_SHELL_INTEGRATION_NO_SUDO", "1");
if (!features.title) try env.put("GHOSTTY_SHELL_INTEGRATION_NO_TITLE", "1");
}
/// Setup the bash automatic shell integration. This works by
/// starting bash in POSIX mode and using the ENV environment
/// variable to load our bash integration script. This prevents