fix range exception when highlighting text

This commit is contained in:
anthony 2020-12-28 16:32:01 +00:00
parent eb5c01edf7
commit ad386a3287
1 changed files with 1 additions and 1 deletions

View File

@ -76,7 +76,7 @@ static nserror cocoa_font_position(const plot_font_style_t *style,
}
NSUInteger glyphIndex = cocoa_glyph_for_location(layout, x);
if (glyphIndex >= length) {
if (glyphIndex >= [layout numberOfGlyphs]) {
*char_offset = length;
} else {
NSUInteger chars = [layout characterIndexForGlyphAtIndex: glyphIndex];