Move to the beginning of a line

1 Answer 67 Views
SyntaxEditor
Troy
Top achievements
Rank 3
Bronze
Iron
Iron
Troy asked on 12 Feb 2023, 04:40 AM

I'm trying to insert text at the start of a line in the radSyntaxEditor.  

I haven't found a way to do it, and was attempting to use the following code

Dim cp As CaretPosition = editor.SyntaxEditorElement.CaretPosition
cp.MoveToLineStart()

However, this doesn't appear to move to the start of the current line.

Ultimately, I'd rather not actually move the cursor, I'd like to insert without doing that.  Is that possible?

Troy
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 12 Feb 2023, 04:48 AM

Ok, I figured out what I was doing wrong with this.

That being said, I'd still like to be able to insert text at the beginning of a line, without actually moving the caret, if possible?

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Feb 2023, 05:22 AM

Hi, Troy,

I am glad that you have found an appropriate solution for your scenario. Please have in mind that the caret position controls where exactly you are navigated inside the editor. It allows you to insert some text at certain places, make selection or delete parts of the document.

That is why you need to navigate to the desired location (e.g. the beginning of the document) and insert the text. After that you can move the cursor to any other location.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
SyntaxEditor
Asked by
Troy
Top achievements
Rank 3
Bronze
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or