Skip to content

Commit

Permalink
Change selected row indexes after reloading table
Browse files Browse the repository at this point in the history
  • Loading branch information
zorgiepoo committed May 11, 2024
1 parent ef8bed6 commit f914a6f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Bit Slicer/ZGVariableController.m
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,6 @@ - (void)removeVariablesAtRowIndexes:(NSIndexSet *)rowIndexes

_documentData.variables = [NSArray arrayWithArray:temporaryArray];

NSUInteger firstRemovedIndex = rowIndexes.firstIndex;
if (firstRemovedIndex > 0)
{
[windowController.variablesTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:firstRemovedIndex - 1] byExtendingSelection:NO];
}

[windowController.searchController fetchVariablesFromResults];

[windowController updateNumberOfValuesDisplayedStatus];
Expand All @@ -381,6 +375,12 @@ - (void)removeVariablesAtRowIndexes:(NSIndexSet *)rowIndexes
[windowController.tableController updateWatchVariablesTimer];
[windowController.variablesTableView reloadData];

NSUInteger firstRemovedIndex = rowIndexes.firstIndex;
if (firstRemovedIndex > 0)
{
[windowController.variablesTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:firstRemovedIndex - 1] byExtendingSelection:NO];
}

[windowController updateSearchAddressOptions];

if (removedAnyLabelVariable)
Expand Down Expand Up @@ -469,15 +469,15 @@ - (void)addVariables:(NSArray<ZGVariable *> *)variables atRowIndexes:(NSIndexSet
NSMutableArray<ZGVariable *> *temporaryArray = [[NSMutableArray alloc] initWithArray:_documentData.variables];
[temporaryArray insertObjects:variables atIndexes:rowIndexes];

[windowController.variablesTableView selectRowIndexes:rowIndexes byExtendingSelection:NO];

[self disableHarmfulVariables:variables];

_documentData.variables = [NSArray arrayWithArray:temporaryArray];

[windowController.tableController updateWatchVariablesTimer];
[windowController.variablesTableView reloadData];

[windowController.variablesTableView selectRowIndexes:rowIndexes byExtendingSelection:NO];

NSString *undoActionName = nil;
if (windowController.undoManager.isUndoing)
{
Expand Down

0 comments on commit f914a6f

Please sign in to comment.