Collapsing regions before rendering

SyntaxEditor for WPF Forum

Posted 5 years ago by Nick
Version: 14.1.0602
Avatar

Hello,

I'm updating some code that uses a syntax editor to display formatted text (hl7). In some cases, this text can be quite large (5 - 10MB) and the bulk of it can be on a single line (think base64/rtf etc). When displaying something like this, the syntax editor is very slow calculating the wrapping. It makes sense to collapse these large blocks of text as they really don't add anything useful to the end user.

I have used the advanced collapsing sample to collapse these blocks of text *after* the text has rendered, but I have not been able to get things working pre-text-render. In my old code I was manually stripping out these large blocks before handing the text to the syntax editor, and then behind the scenes keeping a collection of tags. While this works, it requires a lot back and forth between the original and collapsed text (for other taggers / highlighters etc).

Is there some way of getting the collapsing working pre-render (and so without the performance penalty)?

Thanks.

Comments (4)

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Nick,

What if for those particular IOutliningNodeDefinitions, you set their IsDefaultCollapsed property to true.  Does that work better for you?  It should collapse them by default then.

Please note that if you set the text at runtime while the editor is visible though, the text fully loads but then the parser runs in the worker thread and when the asynchronously completes, will update outlining.  In that scenario, there won't be any help to performance.  If you are able to update outlining manually (maybe you aren't doing outlining based on parse data?) before the SyntaxEditor is visible, it might be better.


Actipro Software Support

Posted 5 years ago by Nick
Avatar

You're right - I'm not doing outlining based on parse data. Before I set the text of the viewer I manually parse the message and determine the start/end offsets that should be collapsed. I then create an ICollapsedRegionTag/IIntraTextSpacerTag and add it to a CollectionTagger<ICollapsedRegionTag>/ITagger<IIntraTextSpacerTag>.

Then I set the text of the syntax editor. This doesn't work at all (doesn't collapse), probably because the collapsing logic is running before the text is actually in the SE.

If I use this same logic with a button, it works fine.

I'll try your suggestions and report back.

Posted 5 years ago by Nick
Avatar

Since I'm doing collapsing manually, it doesn't look like anything to do with IOutlining will be usable. I guess I'll try a few more tweaks and then revert back to my old methodology. Is there any way of adding an adornment / placeholder where I specify the length of the string being replaced? This way I wouldn't need to add my own offset calculation routines.               

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

You could add in a zero-width custom tag that would store the data.  Then you could use a tag aggregator to read in that info.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.