From e4c11d9a88741e6ef2e88445c2c040c46e2fc9bf Mon Sep 17 00:00:00 2001 From: daboe01 Date: Fri, 3 Jul 2015 23:13:57 +0200 Subject: [PATCH] various fixes --- AppKit/CPStringDrawing.j | 4 +++- AppKit/CPTextView/CPTextView.j | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/AppKit/CPStringDrawing.j b/AppKit/CPStringDrawing.j index 90818fc9f..bd506b46e 100644 --- a/AppKit/CPStringDrawing.j +++ b/AppKit/CPStringDrawing.j @@ -24,6 +24,8 @@ @import "CGGeometry.j" @import "CPPlatformString.j" +@import "CPFont.j" +@import "CPCompatibility.j" var CPStringSizeWithFontInWidthCache = [], @@ -71,7 +73,7 @@ CPStringSizeCachingEnabled = YES; CPStringSizeMeasuringContext.font = [aFont cssString]; var teststring = "0123456879abcdefghiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,.-()"; - CPStringSizeIsCanvasSizingInvalid = ABS([CPPlatformString sizeOfString:teststring withFont:aFont forWidth:1000].width - CPStringSizeMeasuringContext.measureText(teststring).width) > 2; + CPStringSizeIsCanvasSizingInvalid = ABS([CPPlatformString sizeOfString:teststring withFont:aFont forWidth:0].width - CPStringSizeMeasuringContext.measureText(teststring).width) > 2; } #endif } diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index 64fd2f455..16c1ab015 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -736,6 +736,7 @@ var kDelegateRespondsTo_textShouldBeginEditing return; if ([event charactersIgnoringModifiers].charCodeAt(0) != 229) // filter out 229 because this would be inserted in chrome on each deadkey + [self interpretKeyEvents:[event]]; [_caret setPermanentlyVisible:YES]; } @@ -1207,7 +1208,7 @@ var kDelegateRespondsTo_textShouldBeginEditing return; var nglyphs = [_layoutManager numberOfCharacters], - loc = nglyphs == _selectionRange.location ? MAX(0, _selectionRange.location - 1) : _selectionRange.location; + loc = nglyphs == _selectionRange.location ? MAX(0, _selectionRange.location - 1) : _selectionRange.location, fragment = [_layoutManager _firstLineFragmentForLineFromLocation:loc]; if (fragment)