Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

AvalonEdit: Copy takes forever for large hightlighted text files

$
0
0

I have loaded a text file (~7 MBytes) into the editor. When I apply syntax highlighting then coping (Control-A and Control-C) the whole text takes forever (without highlighting it's done in a second)

When I break into debugger I get the following callstack (shortened):

System.Text.RegularExpressions.RegexInterpreter.Go() 
System.Text.RegularExpressions.RegexRunner.Scan(regex, text, textbeg, textend, textstart, prevlen, quick, timeout) 
System.Text.RegularExpressions.Regex.Run(quick, prevlen, input, beginning, length, startat) 
System.Text.RegularExpressions.Regex.Match(input, beginning, length) 
ICSharpCode.AvalonEdit.Highlighting.DocumentHighlighter.HighlightNonSpans(until) 
ICSharpCode.AvalonEdit.Highlighting.DocumentHighlighter.HighlightLineInternal(line) 
ICSharpCode.AvalonEdit.Highlighting.DocumentHighlighter.HighlightLineAndUpdateTreeList(line, lineNumber) 
ICSharpCode.AvalonEdit.Highlighting.DocumentHighlighter.HighlightLine(lineNumber) 
ICSharpCode.AvalonEdit.Highlighting.HtmlClipboard.CreateHtmlFragment(document, highlighter, segment, options) 
ICSharpCode.AvalonEdit.Editing.Selection.CreateHtmlFragment(options) 
ICSharpCode.AvalonEdit.Editing.Selection.CreateDataObject(textArea) 
ICSharpCode.AvalonEdit.Editing.EditingCommandHandler.CopySelectedText(textArea) 
ICSharpCode.AvalonEdit.Editing.EditingCommandHandler.OnCopy(target, args) 

It seems the editor creates html-based content for the clipboard and uses RegularExpressions which takes forever (~30 seconds).

 

Question 1: Is this a BUG and can it be made faster?

Question 2: If it cannot be made faster then I would like to disable the syntax highlighting for the copy action so that only pure text is copied to the clipboard - is this possible?

 

Thank you in adavance!


Viewing all articles
Browse latest Browse all 1764

Trending Articles