Outlining ending on last empty line

SyntaxEditor for WPF Forum

Posted 3 years ago by Xinen Lee
Version: 16.1.0633
Avatar

Hi Actipro

 

There's an unexpected behavior with outlining.

My text is "/* abc\r\n". Which gives me "/* abc" on line 1, and an empty line 2.

 

I call AddNode in my OutliningSource using 

AddNode(new TextRange(0, 7), definition)

Where my definition's DefaultCollapsedContent is "/* abc ...", and 7 is the last offset of the whole editor.

 

The resulting outlining starts and ends on line 1, where I would expect it to start on line 1 and end on line 2 where the last offset is, after the terminating character.

Comments (3)

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

Hi Xinen,

In SyntaxEditor, all "\r\n" sequences are internally converted to "\n" only so that lexing is faster and other text searching is easier to do.  Offsets are based on that conversion.  What you really want is text range 0 - 6, where you ignore the "\r".


Actipro Software Support

Posted 3 years ago by Xinen Lee
Avatar

Hi Actipro,

My real issue is that I'm unable to add a last empty line for the TextRange.

If I have 1 line with text and a 2nd empty line, and put in the start offset of the first line to the end offset of the 2nd empty line for the TextRange, the resulting outlining region is only the first line when I expect the resulting outlining region to be from 1st to 2nd line.

I think the SDI Code Editor (Inline) sample may be experiencing the same issue -

1. Delete everything from line 6 (inclusive) onwards such tha thtere are only lines 1-5

2. Press enter to create lines 6 and 7

3. The outlining region only includes last line 7 if it has text, if it is empty, the outlining region is only from line 5 to 6.

I would expect it to include last line 7 regardless of whether it has text or not.

 

The actual problem comes where I have only 2 lines of outlining where the 2nd line is empty, I expect it to outline 2 lines and it ends up outlining only 1 line which I do not want.

[Modified 3 years ago]

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

Hi Xinen,

Thanks for the detail.  I see what you mean and we've just tried to tweak this to work better for this scenario.  If you'd like a preview build to test it on your end, please email our support address and mention this thread.


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.