Skip to content

Commit

Permalink
Merge pull request laullon#193 from gitx/revert-191-claybridges-no-sc…
Browse files Browse the repository at this point in the history
…roll

Revert "Suppress rescroll when repo is updated externally"
  • Loading branch information
tiennou authored Oct 17, 2019
2 parents 093add1 + e2082da commit 14db8cb
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions Classes/Controllers/PBGitHistoryController.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,10 @@ - (void) _repositoryUpdatedNotification:(NSNotification *)notification {
- (void)reselectCommitAfterUpdate {
[self updateStatus];

if ([self.repository.currentBranch isSimpleRef]) {
[self selectCommit:[self.repository OIDForRef:self.repository.currentBranch.ref] withRescroll:NO];
} else {
[self selectCommit:self.firstCommit.OID withRescroll:NO];
}
if ([self.repository.currentBranch isSimpleRef])
[self selectCommit:[self.repository OIDForRef:self.repository.currentBranch.ref]];
else
[self selectCommit:self.firstCommit.OID];
}

- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row {
Expand Down Expand Up @@ -552,11 +551,6 @@ - (NSArray *) selectedObjectsForOID:(GTOID *)commitOID
}

- (void)selectCommit:(GTOID *)commitOID
{
[self selectCommit:commitOID withRescroll:YES];
}

- (void)selectCommit:(GTOID *)commitOID withRescroll:(BOOL)doRescroll
{
if (!forceSelectionUpdate && [[[commitController.selectedObjects lastObject] OID] isEqual:commitOID]) {
return;
Expand All @@ -565,10 +559,8 @@ - (void)selectCommit:(GTOID *)commitOID withRescroll:(BOOL)doRescroll
NSArray *selectedObjects = [self selectedObjectsForOID:commitOID];
[commitController setSelectedObjects:selectedObjects];

if (doRescroll) {
NSInteger oldIndex = [[commitController selectionIndexes] firstIndex];
[self scrollSelectionToTopOfViewFrom:oldIndex];
}
NSInteger oldIndex = [[commitController selectionIndexes] firstIndex];
[self scrollSelectionToTopOfViewFrom:oldIndex];

forceSelectionUpdate = NO;
}
Expand Down

0 comments on commit 14db8cb

Please sign in to comment.