Ignore:
Timestamp:
Dec 10, 2009, 5:25:12 AM (13 years ago)
Author:
livings124
Message:

fix a bug with the new message index code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/MessageWindowController.m

    r9701 r9702  
    159159    [fLock lock];
    160160   
    161     NSUInteger currentCount = [fMessages count];
     161    NSUInteger currentIndex = [fMessages count] > 0 ? [[[fMessages lastObject] objectForKey: @"Index"] unsignedIntegerValue] : 0;
    162162   
    163163    NSScroller * scroller = [[fMessageTable enclosingScrollView] verticalScroller];
    164     const BOOL shouldScroll = currentCount == 0 || [scroller floatValue] == 1.0 || [scroller isHidden]
     164    const BOOL shouldScroll = currentIndex == 0 || [scroller floatValue] == 1.0 || [scroller isHidden]
    165165                                || [scroller knobProportion] == 1.0;
    166166   
     
    179179                                    [NSString stringWithUTF8String: currentMessage->message], @"Message",
    180180                                    [NSDate dateWithTimeIntervalSince1970: currentMessage->when], @"Date",
    181                                     [NSNumber numberWithUnsignedInteger: currentCount++], @"Index", //more accurate when sorting by date
     181                                    [NSNumber numberWithUnsignedInteger: currentIndex++], @"Index", //more accurate when sorting by date
    182182                                    [NSNumber numberWithInteger: currentMessage->level], @"Level",
    183183                                    name, @"Name",
     
    193193    }
    194194   
    195     if (currentCount > TR_MAX_MSG_LOG)
    196     {
    197         NSIndexSet * removeIndexes = [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, currentCount-TR_MAX_MSG_LOG)];
     195    if ([fMessages count] > TR_MAX_MSG_LOG)
     196    {
     197        NSIndexSet * removeIndexes = [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fMessages count]-TR_MAX_MSG_LOG)];
    198198        NSArray * itemsToRemove = [fMessages objectsAtIndexes: removeIndexes];
    199199       
Note: See TracChangeset for help on using the changeset viewer.