Browse Source

Remember decompiled nodes before starting decompilation, this fixes problems with changing tabs while a decompilation is in progress.

pull/2554/head
Siegfried Pammer 4 years ago
parent
commit
9cb0668d17
  1. 7
      ILSpy/TextView/DecompilerTextView.cs
  2. 3
      ILSpy/ViewModels/TabPageModel.cs

7
ILSpy/TextView/DecompilerTextView.cs

@ -152,7 +152,7 @@ namespace ICSharpCode.ILSpy.TextView
{ {
if (this.DataContext is PaneModel model) if (this.DataContext is PaneModel model)
{ {
model.Title = currentTitle ?? ILSpy.Properties.Resources.NewTab; model.Title = currentTitle ?? ILSpy.Properties.Resources.Decompiling;
} }
} }
@ -665,8 +665,8 @@ namespace ICSharpCode.ILSpy.TextView
textOutput.Title = string.Join(", ", nodes.Select(n => n.Text)); textOutput.Title = string.Join(", ", nodes.Select(n => n.Text));
} }
ShowOutput(textOutput, highlighting);
decompiledNodes = nodes; decompiledNodes = nodes;
ShowOutput(textOutput, highlighting);
} }
/// <summary> /// <summary>
@ -815,12 +815,12 @@ namespace ICSharpCode.ILSpy.TextView
return RunWithCancellation( return RunWithCancellation(
delegate (CancellationToken ct) { // creation of the background task delegate (CancellationToken ct) { // creation of the background task
context.Options.CancellationToken = ct; context.Options.CancellationToken = ct;
decompiledNodes = context.TreeNodes;
return DecompileAsync(context, outputLengthLimit); return DecompileAsync(context, outputLengthLimit);
}) })
.Then( .Then(
delegate (AvalonEditTextOutput textOutput) { // handling the result delegate (AvalonEditTextOutput textOutput) { // handling the result
ShowOutput(textOutput, context.Language.SyntaxHighlighting, context.Options.TextViewState); ShowOutput(textOutput, context.Language.SyntaxHighlighting, context.Options.TextViewState);
decompiledNodes = context.TreeNodes;
}) })
.Catch<Exception>(exception => { .Catch<Exception>(exception => {
textEditor.SyntaxHighlighting = null; textEditor.SyntaxHighlighting = null;
@ -835,7 +835,6 @@ namespace ICSharpCode.ILSpy.TextView
output.WriteLine(exception.ToString()); output.WriteLine(exception.ToString());
} }
ShowOutput(output); ShowOutput(output);
decompiledNodes = context.TreeNodes;
}); });
} }

3
ILSpy/ViewModels/TabPageModel.cs

@ -96,6 +96,7 @@ namespace ICSharpCode.ILSpy.ViewModels
textView = new DecompilerTextView(); textView = new DecompilerTextView();
tabPage.Content = textView; tabPage.Content = textView;
} }
tabPage.Title = Properties.Resources.Decompiling;
return action(textView); return action(textView);
} }
@ -106,6 +107,7 @@ namespace ICSharpCode.ILSpy.ViewModels
textView = new DecompilerTextView(); textView = new DecompilerTextView();
tabPage.Content = textView; tabPage.Content = textView;
} }
tabPage.Title = Properties.Resources.Decompiling;
return action(textView); return action(textView);
} }
@ -116,6 +118,7 @@ namespace ICSharpCode.ILSpy.ViewModels
textView = new DecompilerTextView(); textView = new DecompilerTextView();
tabPage.Content = textView; tabPage.Content = textView;
} }
tabPage.Title = Properties.Resources.Decompiling;
action(textView); action(textView);
} }
} }

Loading…
Cancel
Save