Skip to content

Commit

Permalink
A better timing to setTextContainerInset
Browse files Browse the repository at this point in the history
  • Loading branch information
LEOYoon-Tsaw committed Apr 22, 2023
1 parent 49d7e27 commit 37aa363
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions SquirrelPanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -701,10 +701,6 @@ - (void)drawRect:(NSRect)dirtyRect {
CGPathRef preeditPath = CGPathCreateMutable();
SquirrelTheme * theme = self.currentTheme;

NSPoint textFieldOrigin = dirtyRect.origin;
textFieldOrigin.y += theme.edgeInset.height;
textFieldOrigin.x += theme.edgeInset.width;

// Draw preedit Rect
NSRect backgroundRect = dirtyRect;
NSRect containingRect = dirtyRect;
Expand Down Expand Up @@ -860,7 +856,6 @@ - (void)drawRect:(NSRect)dirtyRect {
}
[panelLayer addSublayer: layer];
}
[_textView setTextContainerInset:NSMakeSize(textFieldOrigin.x, textFieldOrigin.y)];
}

- (BOOL)clickAtPoint:(NSPoint)_point index:(NSInteger *)_index {
Expand Down Expand Up @@ -1162,6 +1157,7 @@ - (void)show {
self.appearance = requestedAppearance;
}

[_view.textView setTextContainerInset: theme.edgeInset];
//Break line if the text is too long, based on screen size.
CGFloat textWidth = [self getMaxTextWidth:theme];
CGFloat maxTextHeight = theme.vertical ? _screenRect.size.width - theme.edgeInset.width * 2 : _screenRect.size.height - theme.edgeInset.height * 2;
Expand Down

0 comments on commit 37aa363

Please sign in to comment.