Skip to content

Fix shell-integration-features being ignored with manual shell integration#5048

Merged
mitchellh merged 4 commits intoghostty-org:mainfrom
liby:fix-shell-integration-features-none
Jan 20, 2025
Merged

Fix shell-integration-features being ignored with manual shell integration#5048
mitchellh merged 4 commits intoghostty-org:mainfrom
liby:fix-shell-integration-features-none

Conversation

@liby
Copy link
Copy Markdown
Member

@liby liby commented Jan 14, 2025

Descriptions

The code was short-circuiting the shell integration setup when shell-integration = none, which prevented the feature environment variables from being set. These environment variables are needed even for manual shell integration to work properly.

Changes

  • Extracted feature environment variables setup into a separate setup_features function

  • Modified the shell integration initialization to ensure features are set up even when shell-integration = none

image

Fixes #5046

Copy link
Copy Markdown
Contributor

@jparise jparise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the previous behavior was intentional: when shell integration is disabled, we didn't want to add anything to the shell environment.

@liby
Copy link
Copy Markdown
Member Author

liby commented Jan 14, 2025

Note that the previous behavior was intentional: when shell integration is disabled, we didn't want to add anything to the shell environment.

I apologize for not linking the issue in the PR description. This PR is actually implementing the solution proposed by @mitchellh in #5046, where he stated:

Solution: We currently short circuit shell integration if it is "none" but we should respect the features and pass the proper env vars along even if it is "none"

I'll update the PR description for better tracking.

@jparise
Copy link
Copy Markdown
Contributor

jparise commented Jan 14, 2025

Note that the previous behavior was intentional: when shell integration is disabled, we didn't want to add anything to the shell environment.

I apologize for not linking the issue in the PR description. This PR is actually implementing the solution proposed by @mitchellh in #5046, where he stated:

Solution: We currently short circuit shell integration if it is "none" but we should respect the features and pass the proper env vars along even if it is "none"

Got it. I think that makes sense. If someone doesn't want (automatic) shell integration and doesn't want the environment variables, they can still use:

shell-integration = none
shell-integration-features = false

I think the config documentation for shell-integration-features could use a brief update as part of this change, though. It currently says:

Shell integration features to enable if shell integration itself is enabled.

... which reads more ambiguously now that shell-integration = none will result in the environment variables being set and therefore applying to manual shell integration.

@liby
Copy link
Copy Markdown
Member Author

liby commented Jan 14, 2025

I think the config documentation for shell-integration-features could use a brief update as part of this change

Thanks for the feedback! I've updated the documentation for shell-integration-features to make it clearer.

Please let me know if the updated documentation looks good to you.

Comment thread src/config/Config.zig Outdated
Comment thread src/termio/shell_integration.zig Outdated
@liby liby requested a review from jparise January 14, 2025 16:11
Copy link
Copy Markdown
Contributor

@jparise jparise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple more suggestions, but looks good to me overall!

Comment thread src/config/Config.zig Outdated
Comment thread src/termio/shell_integration.zig Outdated
Copy link
Copy Markdown
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small but important change and it looks good. Thank you!

Comment thread src/termio/shell_integration.zig Outdated
@liby liby requested a review from mitchellh January 15, 2025 00:31
@mitchellh mitchellh enabled auto-merge January 20, 2025 18:14
@mitchellh mitchellh merged commit 8ada93d into ghostty-org:main Jan 20, 2025
@github-actions github-actions Bot added this to the 1.1.0 milestone Jan 20, 2025
@liby liby deleted the fix-shell-integration-features-none branch January 20, 2025 23:27
jparise added a commit to jparise/ghostty that referenced this pull request Dec 23, 2025
Add a unit test to prevent regressions in our failure state.

For example, we always want to set GHOSTTY_SHELL_FEATURES, even if
automatic shell integration fails, because it's also used for manual
shell integration (e.g. ghostty-org#5048).
jparise added a commit to jparise/ghostty that referenced this pull request Dec 23, 2025
Add a unit test to prevent regressions in our failure state.

For example, we always want to set GHOSTTY_SHELL_FEATURES, even if
automatic shell integration fails, because it's also used for manual
shell integration (e.g. ghostty-org#5048).
jparise added a commit to jparise/ghostty that referenced this pull request Dec 23, 2025
Add a unit test to prevent regressions in our failure state.

For example, we always want to set GHOSTTY_SHELL_FEATURES, even if
automatic shell integration fails, because it's also used for manual
shell integration (e.g. ghostty-org#5048).
jparise added a commit that referenced this pull request Dec 23, 2025
Add a unit test to prevent regressions in our failure state.

For example, we always want to set GHOSTTY_SHELL_FEATURES, even if
automatic shell integration fails, because it's also used for manual
shell integration (e.g. #5048).
yasuf pushed a commit to yasuf/ghostty that referenced this pull request Dec 30, 2025
Add a unit test to prevent regressions in our failure state.

For example, we always want to set GHOSTTY_SHELL_FEATURES, even if
automatic shell integration fails, because it's also used for manual
shell integration (e.g. ghostty-org#5048).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shell-integration-features config is ignored on manual shell integration

4 participants