fix<WorkingCopyChanges>: missing context menu items for staged changes; update DiffTarget when items changed

This commit is contained in:
leo 2021-05-08 09:25:16 +08:00
parent 0c6a0bed06
commit af92bbd9b7

View file

@ -177,6 +177,8 @@ namespace SourceGit.Views.Widgets {
if (!newSet.ContainsKey(old.Path)) { if (!newSet.ContainsKey(old.Path)) {
Changes.RemoveAt(i); Changes.RemoveAt(i);
RemoveTreeNode(Nodes, old); RemoveTreeNode(Nodes, old);
if (modeTree.Selected.Contains(old)) modeTree.Selected.Remove(old);
if (DiffTarget == old) DiffTarget = null;
continue; continue;
} }
@ -184,6 +186,8 @@ namespace SourceGit.Views.Widgets {
if (cur.Index != old.Index || cur.WorkTree != old.WorkTree) { if (cur.Index != old.Index || cur.WorkTree != old.WorkTree) {
Changes.RemoveAt(i); Changes.RemoveAt(i);
RemoveTreeNode(Nodes, old); RemoveTreeNode(Nodes, old);
if (modeTree.Selected.Contains(old)) modeTree.Selected.Remove(old);
if (DiffTarget == old) DiffTarget = null;
continue; continue;
} }
@ -619,6 +623,10 @@ namespace SourceGit.Views.Widgets {
Clipboard.SetText(node.Path); Clipboard.SetText(node.Path);
e.Handled = true; e.Handled = true;
}; };
menu.Items.Add(explore);
menu.Items.Add(unstage);
menu.Items.Add(copyPath);
} else { } else {
var unstage = new MenuItem(); var unstage = new MenuItem();
unstage.Header = App.Text("FileCM.UnstageMulti", files.Count); unstage.Header = App.Text("FileCM.UnstageMulti", files.Count);