Skip to content
Snippets Groups Projects
Commit 8c8bd8c5 authored by George Nachman's avatar George Nachman
Browse files

Add debug logging for font size change

parent a6c3d813
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -160,7 +160,7 @@
}
 
- (NSString *)description {
return [NSString stringWithFormat:@"%@ visibleRect:%@", [super description], [NSValue valueWithRect:[self visibleRect]]];
return [NSString stringWithFormat:@"%@ visibleRect:%@", [super description], [NSValue valueWithRect:[self documentVisibleRect]]];
}
 
- (void)drawBackgroundImageRect:(NSRect)rect useTransparency:(BOOL)useTransparency
Loading
Loading
Loading
Loading
@@ -66,6 +66,27 @@
#define DEBUG_KEYDOWNDUMP 0
#define ASK_ABOUT_OUTDATED_FORMAT @"AskAboutOutdatedKeyMappingForGuid%@"
 
@interface NSView (RecursiveDescription)
- (NSString *)iterm_recursiveDescription;
@end
@implementation NSView (RecursiveDescription)
- (NSString *)recursiveDescriptionWithPrefix:(NSString *)prefix {
NSMutableString *s = [NSMutableString string];
[s appendFormat:@"%@%@ frame=%@\n", prefix, self, [NSValue valueWithRect:self.frame]];
for (NSView *view in [self subviews]) {
[s appendString:[view recursiveDescriptionWithPrefix:[prefix stringByAppendingString:@"| "]]];
}
return s;
}
- (NSString *)iterm_recursiveDescription {
return [self recursiveDescriptionWithPrefix:@""];
}
@end
@implementation PTYSession
 
static NSString *TERM_ENVNAME = @"TERM";
Loading
Loading
@@ -201,6 +222,11 @@ static NSString *kTmuxFontChanged = @"kTmuxFontChanged";
#endif
}
 
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p %dx%d>", [self class], self, [SCREEN width], [SCREEN height]];
}
- (void)cancelTimers
{
[view cancelTimers];
Loading
Loading
@@ -536,6 +562,7 @@ static NSString *kTmuxFontChanged = @"kTmuxFontChanged";
 
- (void)setWidth:(int)width height:(int)height
{
DLog(@"Set session %@ to %dx%d", self, width, height);
[SCREEN resizeWidth:width height:height];
[SHELL setWidth:width height:height];
[TEXTVIEW clearHighlights];
Loading
Loading
@@ -3428,13 +3455,19 @@ static long long timeInTenthsOfSeconds(struct timeval t)
horizontalSpacing:(float)horizontalSpacing
verticalSpacing:(float)verticalSpacing
{
DLog(@"setFont:%@ nafont:%@", font, nafont);
NSWindow *window = [[[self tab] realParentWindow] window];
DLog(@"Before:\n%@", [window.contentView iterm_recursiveDescription]);
DLog(@"Window frame: %@", window);
if ([[TEXTVIEW font] isEqualTo:font] &&
[[TEXTVIEW nafont] isEqualTo:nafont] &&
[TEXTVIEW horizontalSpacing] == horizontalSpacing &&
[TEXTVIEW verticalSpacing] == verticalSpacing) {
return;
}
DLog(@"Line height was %f", (float)[TEXTVIEW lineHeight]);
[TEXTVIEW setFont:font nafont:nafont horizontalSpacing:horizontalSpacing verticalSpacing:verticalSpacing];
DLog(@"Line height is now %f", (float)[TEXTVIEW lineHeight]);
if (![[[self tab] parentWindow] anyFullScreen]) {
if ([[PreferencePanel sharedInstance] adjustWindowForFontSizeChange]) {
[[[self tab] parentWindow] fitWindowToTab:[self tab]];
Loading
Loading
@@ -3447,6 +3480,8 @@ static long long timeInTenthsOfSeconds(struct timeval t)
} else {
[[self tab] fitSessionToCurrentViewSize:self];
}
DLog(@"After:\n%@", [window.contentView iterm_recursiveDescription]);
DLog(@"Window frame: %@", window);
}
 
- (void)synchronizeTmuxFonts:(NSNotification *)notification
Loading
Loading
@@ -3507,11 +3542,13 @@ static long long timeInTenthsOfSeconds(struct timeval t)
 
- (void)changeFontSizeDirection:(int)dir
{
DLog(@"changeFontSizeDirection:%d", dir);
NSFont* font;
NSFont* nafont;
float hs, vs;
if (dir) {
// Grow or srhink
// Grow or shrink
DLog(@"grow/shrink");
font = [self fontWithRelativeSize:dir from:[TEXTVIEW font]];
nafont = [self fontWithRelativeSize:dir from:[TEXTVIEW nafont]];
hs = [TEXTVIEW horizontalSpacing];
Loading
Loading
Loading
Loading
@@ -1750,6 +1750,7 @@ static NSString* FormatRect(NSRect r) {
BOOL hasScrollbar = ![parentWindow_ anyFullScreen] && ![[PreferencePanel sharedInstance] hideScrollbar];
[[aSession SCROLLVIEW] setHasVerticalScroller:hasScrollbar];
NSSize size = [[aSession view] maximumPossibleScrollViewContentSize];
DLog(@"Max size is %@", [NSValue valueWithSize:size]);
int width = (size.width - MARGIN*2) / [[aSession TEXTVIEW] charWidth];
int height = (size.height - VMARGIN*2) / [[aSession TEXTVIEW] lineHeight];
PtyLog(@"fitSessionToCurrentViewSize %@ gives %d rows", [NSValue valueWithSize:size], height);
Loading
Loading
@@ -1770,6 +1771,7 @@ static NSString* FormatRect(NSRect r) {
// containing view.
- (BOOL)fitSessionToCurrentViewSize:(PTYSession*)aSession
{
DLog(@"fitSessionToCurrentViewSize:%@", aSession);
if ([aSession isTmuxClient]) {
return NO;
}
Loading
Loading
Loading
Loading
@@ -588,8 +588,10 @@ static NSDate* lastResizeDate_;
- (NSSize)maximumPossibleScrollViewContentSize
{
NSSize size = self.frame.size;
DLog(@"maximumPossibleScrollViewContentSize. size=%@", [NSValue valueWithSize:size]);
if (showTitle_) {
size.height -= kTitleHeight;
DLog(@"maximumPossibleScrollViewContentSize: sub title height. size=%@", [NSValue valueWithSize:size]);
}
return [NSScrollView contentSizeForFrameSize:size
hasHorizontalScroller:NO
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment