Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
「View」を「Wrap Lines」 にしたときに SubString で ArgumentOutOfRangeException が発…
…生するので調査&修正。

fix #1
  • Loading branch information
kkato233 committed Sep 5, 2020
1 parent d292b6d commit 8648259
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions Azuki/View/PropWrapView.cs
Expand Up @@ -718,36 +718,6 @@ void DrawLine( IGraphics g, int lineIndex, Point pos, Rectangle clipRect )
}
}

// if the token area crosses the RIGHT boundary, cut off extra
if( clipRect.Right < tokenEndPos.X )
{
int visCharCount; // visible char count
int visPartRight;
int peekingCharRight = 0;

// calculate number of chars which fits within the clip-rect
visPartRight = MeasureTokenEndX( g, token, pos.X, clipRect.Right, out visCharCount );

// (if the clip-rect's right boundary is NOT the text area's right boundary,
// we must write one more char so that the peeking char appears at the boundary.)

// try to get graphically peeking (drawn over the border line) char
var peekingChar = new TextSegment( visCharCount, TextUtil.NextGraphemeClusterIndex(Document.InternalBuffer, visCharCount) );

// calculate right end coordinate of the peeking char
if( peekingChar.IsEmpty == false )
{
peekingCharRight = MeasureTokenEndX( g, peekingChar, visPartRight );
}

// cut trailing extra
token = token.Substring( 0, visCharCount+peekingChar.Length );
tokenEndPos.X = (peekingCharRight != 0) ? peekingCharRight : visPartRight;

// to terminate this loop, set token end position to invalid one
end = Int32.MaxValue;
}

// draw this token
DrawToken( g, Document, begin, token, klass, ref pos, ref tokenEndPos, ref clipRect, inSelection );

Expand Down

0 comments on commit 8648259

Please sign in to comment.