Skip to content

Commit

Permalink
Don't show timestamps for untouched lines in new sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
gnachman committed Jul 7, 2016
1 parent ba7d35a commit ebde8f2
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions sources/PseudoTerminal.m
Original file line number Diff line number Diff line change
Expand Up @@ -6338,6 +6338,7 @@ - (void)setupSession:(PTYSession *)aSession
[aSession setPreferencesFromAddressBookEntry:tempPrefs];
[aSession loadInitialColorTable];
[aSession setBookmarkName:[tempPrefs objectForKey:KEY_NAME]];
[aSession.screen resetTimestamps];

if (title) {
[aSession setName:title];
Expand Down
3 changes: 3 additions & 0 deletions sources/VT100Grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@
// Restore saved state excluding screen contents.
- (void)setStateFromDictionary:(NSDictionary *)dict;

// Reset timestamps to the uninitialized state.
- (void)resetTimestamps;

#pragma mark - Testing use only

- (VT100LineInfo *)lineInfoAtLineNumber:(int)lineNumber;
Expand Down
5 changes: 5 additions & 0 deletions sources/VT100Grid.m
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,11 @@ - (void)setStateFromDictionary:(NSDictionary *)dict {
}
}

- (void)resetTimestamps {
for (VT100LineInfo *info in lineInfos_) {
info.timestamp = 0;
}
}

#pragma mark - Private

Expand Down
5 changes: 2 additions & 3 deletions sources/VT100LineInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ - (instancetype)initWithWidth:(int)width {
width_ = width;
start_ = -1;
bound_ = -1;
[self setDirty:NO inRange:VT100GridRangeMake(0, width) updateTimestamp:YES];
[self updateTimestamp];
[self setDirty:NO inRange:VT100GridRangeMake(0, width) updateTimestamp:NO];
}
return self;
}
Expand Down Expand Up @@ -71,7 +70,7 @@ - (VT100GridRange)dirtyRange {
}

- (void)updateTimestamp {
timestamp_ = [NSDate timeIntervalSinceReferenceDate];
self.timestamp = [NSDate timeIntervalSinceReferenceDate];
}

- (BOOL)isDirtyAtOffset:(int)x {
Expand Down
3 changes: 3 additions & 0 deletions sources/VT100Screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ extern int kVT100ScreenMinRows;
// Zero-based (as VT100GridCoord always is), unlike -cursorX and -cursorY.
- (void)setCursorPosition:(VT100GridCoord)coord;

// Uninitialize timestamps.
- (void)resetTimestamps;

@end

@interface VT100Screen (Testing)
Expand Down
5 changes: 5 additions & 0 deletions sources/VT100Screen.m
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,11 @@ - (void)setCursorPosition:(VT100GridCoord)coord {
currentGrid_.cursor = coord;
}

- (void)resetTimestamps {
[primaryGrid_ resetTimestamps];
[altGrid_ resetTimestamps];
}

// Like getLineAtIndex:withBuffer:, but uses dedicated storage for the result.
// This function is dangerous! It writes to an internal buffer and returns a
// pointer to it. Better to use getLineAtIndex:withBuffer:.
Expand Down

0 comments on commit ebde8f2

Please sign in to comment.