Skip to content

Commit

Permalink
Fix bug where switching between documents selected the first history …
Browse files Browse the repository at this point in the history
…item
  • Loading branch information
cameronwhite committed Dec 27, 2024
1 parent 3f16643 commit 557db9f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Pinta.Gui.Widgets/Widgets/History/HistoryListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,21 @@ private void OnActiveDocumentChanged (object? sender, EventArgs e)
// Clear out old items and rebuild.
model.RemoveMultiple (0, model.GetNItems ());

active_document = doc;

if (doc is not null) {
foreach (BaseHistoryItem item in doc.History.Items) {
model.Append (new HistoryListViewItem (item));
}

// Move selection to the document's current history item.
if (model.NItems > 0)
selection_model.SetSelected ((uint) doc.History.Pointer);

doc.History.HistoryItemAdded += OnHistoryItemAdded;
doc.History.ActionUndone += OnUndoOrRedo;
doc.History.ActionRedone += OnUndoOrRedo;
}

active_document = doc;
}

private void OnHistoryItemAdded (object? sender, HistoryItemAddedEventArgs args)
Expand Down

0 comments on commit 557db9f

Please sign in to comment.