Retrieve Start/End Column Index For Selection

SyntaxEditor for Windows Forms Forum

Posted 6 years ago by Jason Tobiasz
Version: 13.1.0310
Avatar

The ALT+selection modification enhancement was asked for in this thread: http://www.actiprosoftware.com/community/thread/352/feature-request-column-highlighting#1057 (nearly a decade ago).  Has this enhancement been implemented?  If not, I'm running into sort of an issue with our own custom implementation ALT+selection modifications.

Consider the following:

Image and video hosting by TinyPic (this is our syntax editor control)

int start = this.SelectedView.Selection.TextRange.StartOffset; // 11
int end = this.SelectedView.Selection.TextRange.EndOffset; // 26

The first line is of length 11, but the hightlighted selection starts in column 13...so start will always be 11.  UGH!  It almost seems necessary to know what the start/end columns are in order to implement ALT+selection.  That is...unless anyone knows a good workaround?

[Modified 6 years ago]

Comments (3)

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

Hi Jason,

Which version are you on?  Block selection (via Alt) is supported in the latest versions.  It should be the range of edit positions, not offsets per se.


Actipro Software Support

Posted 6 years ago by Jason Tobiasz
Avatar

We are using 2013.1 build 0310.  Yes, block selection (via Alt) is supported in the latest version, but not fully.  It doesn't behave like other editors (say, Visual Studio or Notepad++).  My biggest gripe is that it doesn't support having the caret over multiple lines.  So you couldn't type in characters on several lines at the sime time.  Oh, and zero-width selections (which is fine since you can work around this pretty easily).

You mentioned "range of edit positions".  How do I get access to that collection?

[Modified 6 years ago]

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

For zero-width selections, if I'm on a line and do Ctrl+Alt+Down, it's zero width and selects both lines fully.  Is that what you mean there or something else?

A lot of the code for managing block selections is internal.  However you can set the edit position range like:

editor.SelectedView.Selection.SelectRange(startEditPos, endEditPos, SelectionModes.Block);

Then props like the selection's StartEditPosition, etc. return the edit position. 


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 7 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.