Merged George's underline & draw speed patch

git-svn-id: http://macvim.googlecode.com/svn/trunk@310 96c4425d-ca35-0410-94e5-3396d5c13a8f
This commit is contained in:
Bjorn Winckler
2007-10-13 11:55:37 +00:00
parent 2df36264dc
commit 82fdf529ec
4 changed files with 114 additions and 58 deletions
+5 -3
View File
@@ -26,6 +26,7 @@
// long periods without the screen updating (e.g. when sourcing a large session
// file). (The unit is seconds.)
static float MMFlushTimeoutInterval = 0.1f;
static int MMFlushQueueLenHint = 80*40;
static unsigned MMServerMax = 1000;
@@ -377,7 +378,8 @@ enum {
// was called MacVim would feel unresponsive. So there is a time out which
// ensures that the queue isn't flushed too often.
if (!force && lastFlushDate && -[lastFlushDate timeIntervalSinceNow]
< MMFlushTimeoutInterval)
< MMFlushTimeoutInterval
&& [drawData length] < MMFlushQueueLenHint)
return;
if ([drawData length] > 0) {
@@ -1016,7 +1018,7 @@ enum {
[self queueMessage:LeaveFullscreenMsgID data:nil];
}
- (oneway void)processInput:(int)msgid data:(in NSData *)data
- (oneway void)processInput:(int)msgid data:(in bycopy NSData *)data
{
// NOTE: This method might get called whenever the run loop is tended to.
// Thus it might get called whilst input is being processed. Normally this
@@ -1040,7 +1042,7 @@ enum {
}
}
- (oneway void)processInputAndData:(in NSArray *)messages
- (oneway void)processInputAndData:(in bycopy NSArray *)messages
{
// NOTE: See comment in processInput:data:.
unsigned i, count = [messages count];
+105 -51
View File
@@ -231,12 +231,25 @@
else if (flags & DRAW_ITALIC)
theFont = italicFont;
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
NSDictionary *attributes;
if (flags & DRAW_UNDERC) {
// move the undercurl down a bit so it is visible
attributes = [NSDictionary dictionaryWithObjectsAndKeys:
theFont, NSFontAttributeName,
bg, NSBackgroundColorAttributeName,
fg, NSForegroundColorAttributeName,
sp, NSUnderlineColorAttributeName,
[NSNumber numberWithFloat:2],NSBaselineOffsetAttributeName,
nil];
} else {
attributes = [NSDictionary dictionaryWithObjectsAndKeys:
theFont, NSFontAttributeName,
bg, NSBackgroundColorAttributeName,
fg, NSForegroundColorAttributeName,
sp, NSUnderlineColorAttributeName,
nil];
}
[attribString setAttributes:attributes range:range];
if (flags & DRAW_UNDERL) {
@@ -282,33 +295,54 @@
NSRange srcRange = { (row+count)*(maxColumns+1) + left, width };
int i;
for (i = 0; i < move; ++i) {
NSAttributedString *srcString = [attribString
attributedSubstringFromRange:srcRange];
[attribString replaceCharactersInRange:destRange
withAttributedString:srcString];
[self edited:(NSTextStorageEditedCharacters
| NSTextStorageEditedAttributes)
range:destRange changeInLength:0];
destRange.location += maxColumns+1;
srcRange.location += maxColumns+1;
}
if (width != maxColumns) { // if this is the case, then left must be 0
for (i = 0; i < move; ++i) {
NSAttributedString *srcString = [attribString
attributedSubstringFromRange:srcRange];
[attribString replaceCharactersInRange:destRange
withAttributedString:srcString];
[self edited:(NSTextStorageEditedCharacters
| NSTextStorageEditedAttributes)
range:destRange changeInLength:0];
destRange.location += maxColumns+1;
srcRange.location += maxColumns+1;
}
NSRange emptyRange = {0,width};
NSAttributedString *emptyString =
[emptyRowString attributedSubstringFromRange: emptyRange];
NSDictionary *attribs = [NSDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
color, NSBackgroundColorAttributeName, nil];
NSRange emptyRange = {0,width};
NSAttributedString *emptyString =
[emptyRowString attributedSubstringFromRange: emptyRange];
NSDictionary *attribs = [NSDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
color, NSBackgroundColorAttributeName, nil];
for (i = 0; i < count; ++i) {
[attribString replaceCharactersInRange:destRange
withAttributedString:emptyString];
[attribString setAttributes:attribs range:destRange];
for (i = 0; i < count; ++i) {
[attribString replaceCharactersInRange:destRange
withAttributedString:emptyString];
[attribString setAttributes:attribs range:destRange];
[self edited:(NSTextStorageEditedAttributes
| NSTextStorageEditedCharacters) range:destRange
changeInLength:0];
destRange.location += maxColumns+1;
}
} else {
NSRange delRange = {row*(maxColumns+1), count*(maxColumns+1)};
[attribString deleteCharactersInRange: delRange];
destRange.location += move*(maxColumns+1);
NSDictionary *attribs = [NSDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
color, NSBackgroundColorAttributeName, nil];
destRange.length = maxColumns;
for (i = 0; i < count; ++i) {
[attribString insertAttributedString:emptyRowString
atIndex:destRange.location];
[attribString setAttributes:attribs range:destRange];
destRange.location += maxColumns+1;
}
NSRange editedRange = {row*(maxColumns+1),total*(maxColumns+1)};
[self edited:(NSTextStorageEditedAttributes
| NSTextStorageEditedCharacters) range:destRange
changeInLength:0];
destRange.location += maxColumns+1;
| NSTextStorageEditedCharacters) range:editedRange
changeInLength:0];
}
}
@@ -336,33 +370,53 @@
NSRange srcRange = { (row+move-1)*(maxColumns+1) + left, width };
int i;
for (i = 0; i < move; ++i) {
NSAttributedString *srcString = [attribString
attributedSubstringFromRange:srcRange];
[attribString replaceCharactersInRange:destRange
withAttributedString:srcString];
[self edited:(NSTextStorageEditedCharacters
| NSTextStorageEditedAttributes)
range:destRange changeInLength:0];
destRange.location -= maxColumns+1;
srcRange.location -= maxColumns+1;
}
NSRange emptyRange = {0,width};
NSAttributedString *emptyString =
[emptyRowString attributedSubstringFromRange:emptyRange];
NSDictionary *attribs = [NSDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
color, NSBackgroundColorAttributeName, nil];
for (i = 0; i < count; ++i) {
[attribString replaceCharactersInRange:destRange
withAttributedString:emptyString];
[attribString setAttributes:attribs range:destRange];
if (width != maxColumns) { // if this is the case, then left must be 0
for (i = 0; i < move; ++i) {
NSAttributedString *srcString = [attribString
attributedSubstringFromRange:srcRange];
[attribString replaceCharactersInRange:destRange
withAttributedString:srcString];
[self edited:(NSTextStorageEditedCharacters
| NSTextStorageEditedAttributes)
range:destRange changeInLength:0];
destRange.location -= maxColumns+1;
srcRange.location -= maxColumns+1;
}
NSRange emptyRange = {0,width};
NSAttributedString *emptyString =
[emptyRowString attributedSubstringFromRange:emptyRange];
NSDictionary *attribs = [NSDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
color, NSBackgroundColorAttributeName, nil];
for (i = 0; i < count; ++i) {
[attribString replaceCharactersInRange:destRange
withAttributedString:emptyString];
[attribString setAttributes:attribs range:destRange];
[self edited:(NSTextStorageEditedAttributes
| NSTextStorageEditedCharacters) range:destRange
changeInLength:0];
destRange.location -= maxColumns+1;
}
} else {
NSRange delRange = {(row+move)*(maxColumns+1),count*(maxColumns+1)};
[attribString deleteCharactersInRange: delRange];
NSDictionary *attribs = [NSDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
color, NSBackgroundColorAttributeName, nil];
destRange.location = row*(maxColumns+1);
for (i = 0; i < count; ++i) {
[attribString insertAttributedString:emptyRowString
atIndex:destRange.location];
[attribString setAttributes:attribs range:destRange];
}
NSRange editedRange = {row*(maxColumns+1),total*(maxColumns+1)};
[self edited:(NSTextStorageEditedAttributes
| NSTextStorageEditedCharacters) range:destRange
| NSTextStorageEditedCharacters) range:editedRange
changeInLength:0];
destRange.location -= maxColumns+1;
}
}
+1 -1
View File
@@ -414,7 +414,7 @@ static NSMenuItem *findMenuItemWithTagInMenu(NSMenu *root, int tag)
[alert release];
}
- (oneway void)processCommandQueue:(in NSArray *)queue
- (oneway void)processCommandQueue:(in bycopy NSArray *)queue
{
if (!isInitialized) return;
+3 -3
View File
@@ -30,8 +30,8 @@
// @try/@catch/@finally to deal with timeouts.
//
@protocol MMBackendProtocol
- (oneway void)processInput:(int)msgid data:(in NSData *)data;
- (oneway void)processInputAndData:(in NSArray *)messages;
- (oneway void)processInput:(int)msgid data:(in bycopy NSData *)data;
- (oneway void)processInputAndData:(in bycopy NSArray *)messages;
- (BOOL)checkForModifiedBuffers;
- (oneway void)setDialogReturn:(in bycopy id)obj;
- (BOOL)starRegisterToPasteboard:(byref NSPasteboard *)pboard;
@@ -42,7 +42,7 @@
// This is the protocol MMVimController implements.
//
@protocol MMFrontendProtocol
- (oneway void)processCommandQueue:(in NSArray *)queue;
- (oneway void)processCommandQueue:(in bycopy NSArray *)queue;
- (oneway void)showSavePanelForDirectory:(in bycopy NSString *)dir
title:(in bycopy NSString *)title
saving:(int)saving;