Fix memory leak with IME on macOS (see http://crbug.com/654695)

This commit is contained in:
Marshall Greenblatt 2016-11-10 16:13:14 -05:00
parent 7a2765f89c
commit aeeb51361b
1 changed files with 6 additions and 0 deletions

View File

@ -81,6 +81,12 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
return validAttributesForMarkedText_;
}
- (NSRange)selectedRange {
if (selectedRange_.location == NSNotFound || selectedRange_.length == 0)
return NSMakeRange(NSNotFound, 0);
return selectedRange_;
}
- (NSRange)markedRange {
return hasMarkedText_ ? markedRange_ : NSMakeRange(NSNotFound, 0);
}