From 5298ed9f6182998af37f2d978c03ef7f3f63bccd Mon Sep 17 00:00:00 2001 From: "bjorn.winckler" Date: Sun, 30 Sep 2007 18:27:48 +0000 Subject: [PATCH] - renamed clearAllWithColor to clearAll - clearAll now actually clears all (nothing happened before) git-svn-id: http://macvim.googlecode.com/svn/trunk@297 96c4425d-ca35-0410-94e5-3396d5c13a8f --- MMBackend.m | 2 -- MMTextStorage.h | 2 +- MMTextStorage.m | 48 ++++++++++++++++++------------------------------ MMVimController.m | 4 +--- 4 files changed, 20 insertions(+), 36 deletions(-) diff --git a/MMBackend.m b/MMBackend.m index 7978b1fc..85fe1531 100644 --- a/MMBackend.m +++ b/MMBackend.m @@ -278,8 +278,6 @@ enum { [drawData setLength:0]; [drawData appendBytes:&type length:sizeof(int)]; - - [drawData appendBytes:&defaultBackgroundColor length:sizeof(unsigned)]; } - (void)clearBlockFromRow:(int)row1 column:(int)col1 diff --git a/MMTextStorage.h b/MMTextStorage.h index 0f0fbdff..50f3e6d1 100644 --- a/MMTextStorage.h +++ b/MMTextStorage.h @@ -54,7 +54,7 @@ color:(NSColor *)color; - (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2 column:(int)col2 color:(NSColor *)color; -- (void)clearAllWithColor:(NSColor *)color; +- (void)clearAll; - (void)setDefaultColorsBackground:(NSColor *)bgColor foreground:(NSColor *)fgColor; - (void)setFont:(NSFont *)newFont; diff --git a/MMTextStorage.m b/MMTextStorage.m index 1bfb77ed..719b18b2 100644 --- a/MMTextStorage.m +++ b/MMTextStorage.m @@ -25,7 +25,7 @@ @interface MMTextStorage (Private) -- (void)lazyResize; +- (void)lazyResize:(BOOL)force; @end @@ -194,8 +194,10 @@ withFlags:(int)flags foregroundColor:(NSColor *)fg backgroundColor:(NSColor *)bg specialColor:(NSColor *)sp { - //NSLog(@"replaceString:atRow:%d column:%d withFlags:%d", row, col, flags); - [self lazyResize]; + //NSLog(@"replaceString:atRow:%d column:%d withFlags:%d " + // "foreground:%@ background:%@ special:%@", + // row, col, flags, fg, bg, sp); + [self lazyResize:NO]; // TODO: support DRAW_TRANSP if (flags & DRAW_TRANSP) @@ -264,8 +266,8 @@ scrollBottom:(int)bottom left:(int)left right:(int)right color:(NSColor *)color { - //NSLog(@"deleteLinesFromRow:%d lineCount:%d", row, count); - [self lazyResize]; + //NSLog(@"deleteLinesFromRow:%d lineCount:%d color:%@", row, count, color); + [self lazyResize:NO]; if (row < 0 || row+count > maxRows) { //NSLog(@"[%s] WARNING : out of range, row=%d (%d) count=%d", _cmd, row, @@ -318,8 +320,8 @@ scrollBottom:(int)bottom left:(int)left right:(int)right color:(NSColor *)color { - //NSLog(@"insertLinesAtRow:%d lineCount:%d", row, count); - [self lazyResize]; + //NSLog(@"insertLinesAtRow:%d lineCount:%d color:%@", row, count, color); + [self lazyResize:NO]; if (row < 0 || row+count > maxRows) { //NSLog(@"[%s] WARNING : out of range, row=%d (%d) count=%d", _cmd, row, @@ -367,9 +369,9 @@ - (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2 column:(int)col2 color:(NSColor *)color { - //NSLog(@"clearBlockFromRow:%d column:%d toRow:%d column:%d", row1, col1, - // row2, col2); - [self lazyResize]; + //NSLog(@"clearBlockFromRow:%d column:%d toRow:%d column:%d color:%@", + // row1, col1, row2, col2, color); + [self lazyResize:NO]; if (row1 < 0 || row2 >= maxRows || col1 < 0 || col2 > maxColumns) { //NSLog(@"[%s] WARNING : out of range, row1=%d row2=%d (%d) col1=%d " @@ -399,31 +401,17 @@ } } -- (void)clearAllWithColor:(NSColor *)color +- (void)clearAll { //NSLog(@"%s%@", _cmd, color); - [self lazyResize]; - - [attribString release]; - attribString = [[NSMutableAttributedString alloc] init]; - NSRange fullRange = NSMakeRange(0, [attribString length]); - - int i; - for (i=0; i