Text Navigation in WPF Syntax Editor

Syntax Editor offers extensive support to text navigation. Users can perform navigation between characters, words, and line items using the built-in functions or keyboard shortcut keys.

Programmatic Navigation

Character based navigation

The following functions enables text navigation in the Syntax Editor in terms of characters or columns.

  1. MoveToPreviousIndex to move cursor position in backward position.

  2. MoveToNextIndex to move cursor position in forward position in .

//To move cursor to previous index
this.editControl.MoveToPreviousIndex();
//To move cursor to previous index
Me.editControl.MoveToPreviousIndex()

Word based navigation

The following functions enables text navigation in the Syntax Editor in terms of words.

  1. MoveToNextWord moves cursor to start position of next word.

  2. MoveToPreviousWord moves cursor to start position of previous word.

//To move cursor to next word
this.editControl.MoveToNextWord();
//To move cursor to next word
Me.editControl.MoveToPreviousWord()

Line based navigation

The following functions enables text navigation in the Syntax Editor in terms of lines.

  1. MoveToNextLine to move cursor to same position on next line.

  2. MoveToPreviousLine to move cursor to same position on previous line.

  3. MoveToLineStart to move cursor to start postion of current line.

  4. MoveToLineEnd to move cursor to end postion of current line.

//To move cursor to next line
this.editControl.MoveToNextLine();
//To move cursor to next line
Me.editControl.MoveToNextLine()

Keyboard Navigation

The following keyboard shortcuts are supported for cursor navigation in Syntax Editor.

Navigation Shortcut Keys

Descriptions

Right arrow

Moves the cursor to a position forward in the current line item.

Left arrow

Moves the cursor to the end position of the current line item.

Down arrow

Moves the cursor to the same position on the next line item.

Up arrow

Moves the cursor to the same position on the previous line item.

Home

Moves the cursor to the start position of the current line item.

End

Moves the cursor to the end position of the current line item.

Ctrl + Right arrow

Moves the cursor to the start position of the next word.

Ctrl + Left arrow

Moves the cursor to the start position of the previous word.

Ctrl + Home

Moves the cursor to the document start position.

Ctrl + End

Moves the cursor to the end position of document.