How to use CurrentDocumentLine.IndentAmount?

SyntaxEditor for Windows Forms Forum

Posted 15 years ago by Karl Grambow
Version: 4.0.0257
Avatar
I'm trying to find the Indent Level for a current line so that I can perform some formatting that will involve inserting carriage returns. As such, I need the indent level so that I know how many tabs to add after inserting a carriage return.

I'm doing this like so:

Dim indentLevel As Integer = editor.SelectedView.CurrentDocumentLine.IndentAmount
The problem is, even though I'm on the right line and that line is indented the value always comes back as 0, not matter how many tabs the line has.

Am I doing something wrong? Or is there an easier way to ensure that after a carriage return is inserted that the indent level is preserved?

Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Karl,

I just tried this in our sample project on a line with 2 tabs and that property returned 8 for me (2 tabs x 4 spaces per tab), which was correct.

It sounds like you may be doing something wrong on your end, or are referencing a different editor than what you think you are. You also mentioned you are using a very old build. Perhaps it was a bug in the build you have that has been fixed since then.


Actipro Software Support

Posted 15 years ago by Karl Grambow
Avatar
Apologies,

I was doing this programmaitically and the CurrentDocumentLine was shifting from where I'd previously left the caret.

I'm now identifying the line I want by using the StartOffset of the iToken I'm working with and it's all working fine.

Thanks,

Karl
The latest build of this product (v24.1.0) was released 25 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.