Created
September 10, 2010 15:20
-
-
Save zonble/573821 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PTYTextView 27858 | |
if([self hasMarkedText]) { | |
int len=[markedText length]; | |
if (len>WIDTH-x1) len=WIDTH-x1; | |
NSRect inputFrame = NSMakeRect(floor(x1 * charWidth + MARGIN), (yStart + [dataSource numberOfLines] - HEIGHT) * lineHeight + (lineHeight - cursorHeight), ceil((WIDTH-x1)*cursorWidth),cursorHeight); | |
[markedText drawInRect:inputFrame]; | |
NSAttributedString *attributedStringBeforeCursor = [markedText attributedSubstringFromRange:NSMakeRange(0, IM_INPUT_SELRANGE.location) ]; | |
NSRect spaceFrame = [attributedStringBeforeCursor boundingRectWithSize:inputFrame.size options:0]; | |
NSRect cursorFrame = NSMakeRect(inputFrame.origin.x + spaceFrame.size.width, inputFrame.origin.y, 2.0, inputFrame.size.height); | |
[[NSColor redColor] set]; | |
NSRectFill(cursorFrame); | |
memset([dataSource dirty] + yStart * WIDTH + x1, | |
1, | |
WIDTH - x1 > len*2 ? len*2 : WIDTH-x1); //len*2 is an over-estimation, but safe | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment