Only scroll the grid to the active line if the row has actually changed

Makes it so that undo/redo only scrolls to the active line if it's
different in the two versions of the file.
This commit is contained in:
Thomas Goyne 2014-06-12 07:35:49 -07:00
parent f24a72d8fc
commit 2508dd9c6e
2 changed files with 7 additions and 3 deletions

View file

@ -237,11 +237,13 @@ void BaseGrid::UpdateMaps() {
void BaseGrid::OnActiveLineChanged(AssDialogue *new_active) {
if (new_active) {
int row = new_active->Row;
MakeRowVisible(row);
extendRow = row;
if (new_active->Row != active_row)
MakeRowVisible(new_active->Row);
extendRow = active_row = new_active->Row;
Refresh(false);
}
else
active_row = -1;
}
void BaseGrid::MakeRowVisible(int row) {

View file

@ -55,6 +55,8 @@ class BaseGrid final : public wxWindow {
/// First row that is visible at the current scroll position
int yPos = 0;
int active_row = -1;
agi::Context *context; ///< Associated project context
std::vector<std::unique_ptr<GridColumn>> columns;