VisualLineElementGenerator in AvalonEdit to skip tabs?
-
01-07-2021 - |
Frage
I am writing a text editor using Avalon Edit.
I would like to replace tabs inserted within the text to be unselectable. For example, let's say I have the following line:
(tab)(tab)(tab)"Hi there!"
I would like the carret to skip the first three tabs and position itself directly before the start of the characters.
Is it possible to achieve such an effect using a VisualLineElementGenerator in order to replace tabs with some sort of hidden / unselectable character ?
In other words, I would like to be able to indent my text without being able to select the indentations.
Lösung
This is currently not possible; all VisualLineElements are selectable.
AvalonEdit has the concept of a 'paragraph indentation' that is not selectable, but this isn't exposed in any public API (it is used for the word-wrap indentation).
You could try modifying the TextView.BuildVisualLine
method to support customizable indentation.