Browse Source

Ignore OutOfMemoryException when trying to paste large amounts of text.

pull/21/merge
Daniel Grunwald 14 years ago
parent
commit
1aa10e5bbf
  1. 9
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs

9
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs

@ -387,8 +387,13 @@ namespace ICSharpCode.AvalonEdit.Editing
// convert text back to correct newlines for this document // convert text back to correct newlines for this document
string newLine = TextUtilities.GetNewLineFromDocument(textArea.Document, textArea.Caret.Line); string newLine = TextUtilities.GetNewLineFromDocument(textArea.Document, textArea.Caret.Line);
string text = (string)dataObject.GetData(DataFormats.UnicodeText); string text;
text = TextUtilities.NormalizeNewLines(text, newLine); try {
text = (string)dataObject.GetData(DataFormats.UnicodeText);
text = TextUtilities.NormalizeNewLines(text, newLine);
} catch (OutOfMemoryException) {
return;
}
if (!string.IsNullOrEmpty(text)) { if (!string.IsNullOrEmpty(text)) {
bool fullLine = textArea.Options.CutCopyWholeLine && dataObject.GetDataPresent(LineSelectedType); bool fullLine = textArea.Options.CutCopyWholeLine && dataObject.GetDataPresent(LineSelectedType);

Loading…
Cancel
Save