How To Count Equivalent Number of Tabs

SyntaxEditor for Windows Forms Forum

Posted 15 years ago by Boyd - Automated Software Testing Consultant / Developer, Patterson Consulting, LLC
Avatar
Does SyntaxEditor expose a method for determining how many "tabs" are represented by a series of tabs and spaces? For instance, if TabSize = 4 and I enter "<space><space><space><space>" or "<tab>" ... that's the equivalent of one tab. If I were to enter "<space><space><space><tab>" that's still the equivalent of one tab.

I'm sure you handle this logic internally for the indentation guides and smart indent, so I wasn't sure if it was exposed. If it is exposed, please let me know where to find it. Otherwise, this utility method would be useful if you could expose it.

In the meantime, I'll probably just write my own routine <IMG SRC="wink.gif" border="0">

Thanks!

Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We don't use a method for doing that because it's all relative to your starting point character as well and how many characters outside of a tabstop that is.

Here's some methods that may help depending on your situation. The DisplayLine.GetTabStopLevel should tell you the tabstop level for the start of a display line. The EditorView.GetCharacterColumn method lets you get the column for a character at an offset. That will help you figure out the starting point columnwise since you can divide it by the tabstop size to see if a character is on the bounds of a tabstop or not.


Actipro Software Support

Posted 15 years ago by Boyd - Automated Software Testing Consultant / Developer, Patterson Consulting, LLC
Avatar
DisplayLine.GetTabStopLevel is exactly what I was looking for. Sorry I didn't catch that earlier. Thanks for the tip!
The latest build of this product (v2020.1 build 0400) 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.