Preserve font zoom level during Automatic Profile Switching#634
Open
objectiveSee wants to merge 1 commit into
Open
Preserve font zoom level during Automatic Profile Switching#634objectiveSee wants to merge 1 commit into
objectiveSee wants to merge 1 commit into
Conversation
When Automatic Profile Switching changes profiles, the font zoom level (set via Cmd+Plus/Cmd-Minus) was lost because setPreferencesFromAddressBookEntry: unconditionally resets the font to the profile's configured font. This computes the zoom delta before the switch and re-applies it after, with care to avoid double-applying when restoring divorced profiles from the stack (which already contain the zoomed font in their overrides). Window frame is saved and restored to prevent rounding glitches from intermediate font size changes. Controlled by a new Advanced Setting: "Preserve font zoom level when Automatic Profile Switching changes profiles" (defaults to YES). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gnachman
added a commit
that referenced
this pull request
Apr 8, 2026
When Automatic Profile Switching changes profiles, the font zoom level (set via Cmd+Plus/Cmd-Minus) was lost because setPreferencesFromAddressBookEntry: unconditionally resets the font to the profile's configured font. This computes the zoom delta before the switch and re-applies it after, with care to avoid double-applying when restoring divorced profiles from the stack (which already contain the zoomed font in their overrides). Window adjustments are suppressed via _windowAdjustmentDisabled during font changes to prevent resizing. The base (unzoomed) font point size is tracked in a dedicated ivar rather than re-derived from _originalProfile, so the delta computation does not depend on profile dictionary state. Controlled by a new Advanced Setting: "Preserve font zoom level when Automatic Profile Switching changes profiles" (defaults to YES). Co-Authored-By: Danny Ricciotti <dan.ricciotti@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
setPreferencesFromAddressBookEntry:unconditionally resets the font to the profile's configured font_windowAdjustmentDisabled = YESaroundsetSessionSpecificProfileValues:to prevent window resizing when restoring divorced profile overridesNew Advanced Setting
"Preserve font zoom level when Automatic Profile Switching changes profiles" (defaults to YES, under Session section)
Files Changed
sources/PTYSession.m— modifiedautomaticProfileSwitcherLoadProfile:to save/restore zoom delta and window framesources/iTermAdvancedSettingsModel.h— declarepreserveFontSizeOnAutomaticProfileSwitchsources/iTermAdvancedSettingsModel.m— define setting (defaults to YES)Test plan
cdinto the directory that triggers the profile switch — verify font size is preserved and window does not resizecdout of the directory — verify font size is preserved and window does not resize🤖 Generated with Claude Code