diff --git a/src/Resources/Styles/ContextMenu.xaml b/src/Resources/Styles/ContextMenu.xaml
index c7f40cb1..890709ab 100644
--- a/src/Resources/Styles/ContextMenu.xaml
+++ b/src/Resources/Styles/ContextMenu.xaml
@@ -104,4 +104,6 @@
+
+ None
\ No newline at end of file
diff --git a/src/Views/Widgets/DiffViewer.xaml.cs b/src/Views/Widgets/DiffViewer.xaml.cs
index c94aaac2..9b355b1b 100644
--- a/src/Views/Widgets/DiffViewer.xaml.cs
+++ b/src/Views/Widgets/DiffViewer.xaml.cs
@@ -80,10 +80,10 @@ namespace SourceGit.Views.Widgets {
return;
}
- Diff(repo, opt, false);
+ Diff(repo, opt);
}
- public void Diff(string repo, Option opt, bool clearEditor = true) {
+ public void Diff(string repo, Option opt) {
mask.Visibility = Visibility.Collapsed;
noChange.Visibility = Visibility.Collapsed;
sizeChange.Visibility = Visibility.Collapsed;
@@ -92,7 +92,6 @@ namespace SourceGit.Views.Widgets {
loading.IsAnimating = true;
SetTitle(opt.Path, opt.OrgPath);
- if (clearEditor) ClearEditor();
ClearCache();
this.repo = repo;
@@ -390,6 +389,8 @@ namespace SourceGit.Views.Widgets {
private DataGrid CreateTextEditor(string[] lineNumbers) {
var grid = new DataGrid();
+ grid.EnableRowVirtualization = true;
+ grid.EnableColumnVirtualization = true;
grid.RowHeight = 16.0;
grid.FrozenColumnCount = lineNumbers.Length;
grid.ContextMenuOpening += OnTextDiffContextMenuOpening;
diff --git a/src/Views/Widgets/WorkingCopy.xaml.cs b/src/Views/Widgets/WorkingCopy.xaml.cs
index c24443e3..affb8ff9 100644
--- a/src/Views/Widgets/WorkingCopy.xaml.cs
+++ b/src/Views/Widgets/WorkingCopy.xaml.cs
@@ -99,6 +99,12 @@ namespace SourceGit.Views.Widgets {
if (e.Target == null) {
if (e.HasOthers) {
+ if (container.IsUnstaged) {
+ stagedContainer.UnselectAll();
+ } else {
+ unstagedContainer.UnselectAll();
+ }
+
mergePanel.Visibility = Visibility.Collapsed;
diffViewer.Reset();
}
@@ -106,15 +112,14 @@ namespace SourceGit.Views.Widgets {
return;
}
- mergePanel.Visibility = Visibility.Collapsed;
- diffViewer.Reset();
-
var change = e.Target;
if (change.IsConflit) {
mergePanel.Visibility = Visibility.Visible;
return;
}
+ mergePanel.Visibility = Visibility.Collapsed;
+
if (change.IsAddedToIndex) {
unstagedContainer.UnselectAll();
diff --git a/src/Views/Widgets/WorkingCopyChanges.xaml.cs b/src/Views/Widgets/WorkingCopyChanges.xaml.cs
index 01cca853..da3217bd 100644
--- a/src/Views/Widgets/WorkingCopyChanges.xaml.cs
+++ b/src/Views/Widgets/WorkingCopyChanges.xaml.cs
@@ -319,11 +319,10 @@ namespace SourceGit.Views.Widgets {
stream.Close();
}
- private void OpenUnstagedContextMenuByNodes(List nodes, List changes) {
+ private void OpenUnstagedContextMenuByNodes(ContextMenu menu, List nodes, List changes) {
var files = new List();
foreach (var c in changes) files.Add(c.Path);
- var menu = new ContextMenu();
if (nodes.Count == 1) {
var node = nodes[0];
var path = Path.GetFullPath(Path.Combine(repo, node.Path));
@@ -441,15 +440,12 @@ namespace SourceGit.Views.Widgets {
menu.Items.Add(stash);
menu.Items.Add(patch);
}
-
- menu.IsOpen = true;
}
- private void OpenUnstagedContextMenuByChanges(List changes) {
+ private void OpenUnstagedContextMenuByChanges(ContextMenu menu, List changes) {
var files = new List();
foreach (var c in changes) files.Add(c.Path);
- var menu = new ContextMenu();
if (changes.Count == 1) {
var change = changes[0];
var path = Path.GetFullPath(Path.Combine(repo, change.Path));
@@ -566,8 +562,6 @@ namespace SourceGit.Views.Widgets {
menu.Items.Add(stash);
menu.Items.Add(patch);
}
-
- menu.IsOpen = true;
}
#endregion
@@ -587,11 +581,10 @@ namespace SourceGit.Views.Widgets {
Models.Watcher.Get(repo)?.RefreshWC();
}
- private void OpenStagedContextMenuByNodes(List nodes, List changes) {
+ private void OpenStagedContextMenuByNodes(ContextMenu menu, List nodes, List changes) {
var files = new List();
foreach (var c in changes) files.Add(c.Path);
- var menu = new ContextMenu();
if (nodes.Count == 1) {
var node = nodes[0];
var path = Path.GetFullPath(Path.Combine(repo, node.Path));
@@ -628,15 +621,12 @@ namespace SourceGit.Views.Widgets {
menu.Items.Add(unstage);
}
-
- menu.IsOpen = true;
}
- private void OpenStagedContextMenuByChanges(List changes) {
+ private void OpenStagedContextMenuByChanges(ContextMenu menu, List changes) {
var files = new List();
foreach (var c in changes) files.Add(c.Path);
- var menu = new ContextMenu();
if (changes.Count == 1) {
var change = changes[0];
var path = Path.GetFullPath(Path.Combine(repo, change.Path));
@@ -678,7 +668,6 @@ namespace SourceGit.Views.Widgets {
menu.Items.Add(unstage);
}
- menu.IsOpen = true;
}
#endregion
@@ -696,7 +685,6 @@ namespace SourceGit.Views.Widgets {
} else if (modeTree.Selected.Count == 1) {
var node = modeTree.Selected[0] as ChangeNode;
if (node.IsFolder) {
- if (DiffTarget == null) return;
DiffTarget = null;
hasOthers = true;
} else {
@@ -760,12 +748,14 @@ namespace SourceGit.Views.Widgets {
GetChangesFromNode(o as ChangeNode, changes);
}
+ var menu = new ContextMenu();
if (IsUnstaged) {
- OpenUnstagedContextMenuByNodes(nodes, changes);
+ OpenUnstagedContextMenuByNodes(menu, nodes, changes);
} else {
- OpenStagedContextMenuByNodes(nodes, changes);
+ OpenStagedContextMenuByNodes(menu, nodes, changes);
}
+ menu.IsOpen = true;
ev.Handled = true;
}
@@ -776,28 +766,28 @@ namespace SourceGit.Views.Widgets {
var changes = new List();
if (Mode == Models.Change.DisplayMode.List) {
if (!row.IsSelected) {
- modeList.SelectedItems.Clear();
- modeList.SelectedItems.Add(row.DataContext);
+ modeList.SelectedItem = row.DataContext;
changes.Add(row.DataContext as Models.Change);
} else {
foreach (var c in modeList.SelectedItems) changes.Add(c as Models.Change);
}
} else {
if (!row.IsSelected) {
- modeGrid.SelectedItems.Clear();
- modeGrid.SelectedItems.Add(row.DataContext);
+ modeGrid.SelectedItem = row.DataContext;
changes.Add(row.DataContext as Models.Change);
} else {
foreach (var c in modeGrid.SelectedItems) changes.Add(c as Models.Change);
}
}
+ var menu = new ContextMenu();
if (IsUnstaged) {
- OpenUnstagedContextMenuByChanges(changes);
+ OpenUnstagedContextMenuByChanges(menu, changes);
} else {
- OpenStagedContextMenuByChanges(changes);
+ OpenStagedContextMenuByChanges(menu, changes);
}
+ menu.IsOpen = true;
ev.Handled = true;
}