mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
fix<Clipboard>: fix crash reported by https://gitee.com/sourcegit/sourcegit/issues/I45346
This commit is contained in:
parent
6f61c79e8b
commit
56521d9418
7 changed files with 18 additions and 18 deletions
|
@ -267,7 +267,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copyPath = new MenuItem();
|
var copyPath = new MenuItem();
|
||||||
copyPath.Header = App.Text("CopyPath");
|
copyPath.Header = App.Text("CopyPath");
|
||||||
copyPath.Click += (obj, ev) => {
|
copyPath.Click += (obj, ev) => {
|
||||||
Clipboard.SetText(path);
|
Clipboard.SetDataObject(path, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
menu.Items.Add(copyPath);
|
menu.Items.Add(copyPath);
|
||||||
|
|
|
@ -156,7 +156,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copyPath = new MenuItem();
|
var copyPath = new MenuItem();
|
||||||
copyPath.Header = App.Text("CopyPath");
|
copyPath.Header = App.Text("CopyPath");
|
||||||
copyPath.Click += (obj, ev) => {
|
copyPath.Click += (obj, ev) => {
|
||||||
Clipboard.SetText(change.Path);
|
Clipboard.SetDataObject(change.Path, true);
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
menu.Items.Add(copyPath);
|
menu.Items.Add(copyPath);
|
||||||
|
|
|
@ -690,7 +690,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copy = new MenuItem();
|
var copy = new MenuItem();
|
||||||
copy.Header = App.Text("BranchCM.CopyName");
|
copy.Header = App.Text("BranchCM.CopyName");
|
||||||
copy.Click += (o, e) => {
|
copy.Click += (o, e) => {
|
||||||
Clipboard.SetText(branch.Name);
|
Clipboard.SetDataObject(branch.Name, true);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
menu.Items.Add(copy);
|
menu.Items.Add(copy);
|
||||||
|
@ -721,7 +721,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copy = new MenuItem();
|
var copy = new MenuItem();
|
||||||
copy.Header = App.Text("RemoteCM.CopyURL");
|
copy.Header = App.Text("RemoteCM.CopyURL");
|
||||||
copy.Click += (o, e) => {
|
copy.Click += (o, e) => {
|
||||||
Clipboard.SetText(remote.URL);
|
Clipboard.SetDataObject(remote.URL, true);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -812,7 +812,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copy = new MenuItem();
|
var copy = new MenuItem();
|
||||||
copy.Header = App.Text("BranchCM.CopyName");
|
copy.Header = App.Text("BranchCM.CopyName");
|
||||||
copy.Click += (o, e) => {
|
copy.Click += (o, e) => {
|
||||||
Clipboard.SetText(branch.Remote + "/" + branch.Name);
|
Clipboard.SetDataObject(branch.Remote + "/" + branch.Name, true);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -878,7 +878,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copy = new MenuItem();
|
var copy = new MenuItem();
|
||||||
copy.Header = App.Text("TagCM.Copy");
|
copy.Header = App.Text("TagCM.Copy");
|
||||||
copy.Click += (o, ev) => {
|
copy.Click += (o, ev) => {
|
||||||
Clipboard.SetText(tag.Name);
|
Clipboard.SetDataObject(tag.Name, true);
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -918,7 +918,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copy = new MenuItem();
|
var copy = new MenuItem();
|
||||||
copy.Header = App.Text("Submodule.CopyPath");
|
copy.Header = App.Text("Submodule.CopyPath");
|
||||||
copy.Click += (o, ev) => {
|
copy.Click += (o, ev) => {
|
||||||
Clipboard.SetText(submodule);
|
Clipboard.SetDataObject(submodule, true);
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
builder.AppendLine();
|
builder.AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
Clipboard.SetText(builder.ToString());
|
Clipboard.SetDataObject(builder.ToString(), true);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
foreach (var number in lineNumbers) {
|
foreach (var number in lineNumbers) {
|
||||||
|
@ -476,7 +476,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
builder.AppendLine();
|
builder.AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
Clipboard.SetText(builder.ToString());
|
Clipboard.SetDataObject(builder.ToString(), true);
|
||||||
};
|
};
|
||||||
menu.Items.Add(copy);
|
menu.Items.Add(copy);
|
||||||
menu.IsOpen = true;
|
menu.IsOpen = true;
|
||||||
|
|
|
@ -388,7 +388,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copySHA = new MenuItem();
|
var copySHA = new MenuItem();
|
||||||
copySHA.Header = App.Text("CommitCM.CopySHA");
|
copySHA.Header = App.Text("CommitCM.CopySHA");
|
||||||
copySHA.Click += (o, e) => {
|
copySHA.Click += (o, e) => {
|
||||||
Clipboard.SetText(commit.SHA);
|
Clipboard.SetDataObject(commit.SHA, true);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
menu.Items.Add(copySHA);
|
menu.Items.Add(copySHA);
|
||||||
|
@ -396,9 +396,9 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copyInfo = new MenuItem();
|
var copyInfo = new MenuItem();
|
||||||
copyInfo.Header = App.Text("CommitCM.CopyInfo");
|
copyInfo.Header = App.Text("CommitCM.CopyInfo");
|
||||||
copyInfo.Click += (o, e) => {
|
copyInfo.Click += (o, e) => {
|
||||||
Clipboard.SetText(string.Format(
|
Clipboard.SetDataObject(string.Format(
|
||||||
"SHA: {0}\nTITLE: {1}\nAUTHOR: {2} <{3}>\nTIME: {4}",
|
"SHA: {0}\nTITLE: {1}\nAUTHOR: {2} <{3}>\nTIME: {4}",
|
||||||
commit.SHA, commit.Subject, commit.Committer.Name, commit.Committer.Email, commit.Committer.Time));
|
commit.SHA, commit.Subject, commit.Committer.Name, commit.Committer.Email, commit.Committer.Time), true);
|
||||||
};
|
};
|
||||||
menu.Items.Add(copyInfo);
|
menu.Items.Add(copyInfo);
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
builder.AppendLine();
|
builder.AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
Clipboard.SetText(builder.ToString());
|
Clipboard.SetDataObject(builder.ToString(), true);
|
||||||
};
|
};
|
||||||
menu.Items.Add(copy);
|
menu.Items.Add(copy);
|
||||||
menu.IsOpen = true;
|
menu.IsOpen = true;
|
||||||
|
@ -304,7 +304,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copyPath = new MenuItem();
|
var copyPath = new MenuItem();
|
||||||
copyPath.Header = App.Text("CopyPath");
|
copyPath.Header = App.Text("CopyPath");
|
||||||
copyPath.Click += (obj, ev) => {
|
copyPath.Click += (obj, ev) => {
|
||||||
Clipboard.SetText(node.Path);
|
Clipboard.SetDataObject(node.Path, true);
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -388,7 +388,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copyPath = new MenuItem();
|
var copyPath = new MenuItem();
|
||||||
copyPath.Header = App.Text("CopyPath");
|
copyPath.Header = App.Text("CopyPath");
|
||||||
copyPath.Click += (o, e) => {
|
copyPath.Click += (o, e) => {
|
||||||
Clipboard.SetText(node.Path);
|
Clipboard.SetDataObject(node.Path, true);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copyPath = new MenuItem();
|
var copyPath = new MenuItem();
|
||||||
copyPath.Header = App.Text("CopyPath");
|
copyPath.Header = App.Text("CopyPath");
|
||||||
copyPath.Click += (o, e) => {
|
copyPath.Click += (o, e) => {
|
||||||
Clipboard.SetText(change.Path);
|
Clipboard.SetDataObject(change.Path, true);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -619,7 +619,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copyPath = new MenuItem();
|
var copyPath = new MenuItem();
|
||||||
copyPath.Header = App.Text("CopyPath");
|
copyPath.Header = App.Text("CopyPath");
|
||||||
copyPath.Click += (o, e) => {
|
copyPath.Click += (o, e) => {
|
||||||
Clipboard.SetText(node.Path);
|
Clipboard.SetDataObject(node.Path, true);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -663,7 +663,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
var copyPath = new MenuItem();
|
var copyPath = new MenuItem();
|
||||||
copyPath.Header = App.Text("CopyPath");
|
copyPath.Header = App.Text("CopyPath");
|
||||||
copyPath.Click += (o, e) => {
|
copyPath.Click += (o, e) => {
|
||||||
Clipboard.SetText(change.Path);
|
Clipboard.SetDataObject(change.Path, true);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue