Sign in Join
Wiki copytemporary

SynEdit Markup

English · Polski

For more info on SynEdit go to: SynEdit
This page is a draft ....

Terminology

Coloring
Applying attributes to the Text. Fore- and Background-color, Bold, Italic, Underline, Colored Frame or partial Frame (includes zig-zag line). Also referred to as highlighting, though this term is ambiguous as it can refer to either all coloring, or coloring by the Highlighter only.

Highligher
SynEdit Highlighter

Markup
TSynEditMarkup

token
A fragment of text. Usually a part of a line. This can be at word boundaries, but also go down to individual letters.

About TSynEditMarkup

TSynEditMarkup allows to alter the coloring provided by the Highlighter.

It is used for:

and more

Where the color comes from

SynEdits paint method retrieves the text as a serious of "token".

The primary source of those tokens is the Highligher. In the line:

pascal
a := 1; // comment

The tokens might be

See also SynEdit Highlighter.

Those token a retrieved via a list of TLazSynDisplayView (coupled with TSynEditStrings wrappers of the TextBuffer). This is not important for coloring. Though the TLazSynDisplayView could change color.

Each token is then fed to the list of TSynEditMarkup. Each TSynEditMarkup can define additional coloring. If that happens the tokens will be broken into smaller parts, and the coloring will be combined/mixed/replaced as needed.

TSynEditMarkup

TODO

During paint the following method are called

*

pascal
    Procedure PrepareMarkupForRow(aRow : Integer); virtual;
    Procedure FinishMarkupForRow(aRow : Integer); virtual;

*

pascal
    Procedure BeginMarkup; virtual;
    Procedure EndMarkup; virtual;

*

pascal
    Procedure GetNextMarkupColAfterRowCol(const aRow: Integer;
                                          const aStartCol: TLazSynDisplayTokenBound;
                                          const AnRtlInfo: TLazSynDisplayRtlInfo;
                                          out   ANextPhys, ANextLog: Integer); virtual; abstract;

Given the current position (painting line number ARow, X is specified in AStartCol), the Markup must set ANextPhys or ANextLog to the next X pos at which it wants to change coloring.

If the Markup wants to change text to Bold from X=5 to X=10 and X=15 to X=20, then

*

pascal
    Function  GetMarkupAttributeAtRowCol(const aRow: Integer;
                                         const aStartCol: TLazSynDisplayTokenBound;
                                         const AnRtlInfo: TLazSynDisplayRtlInfo) : TSynSelectedColor; virtual; abstract;

If AStartCol is within any range for that the Markup want to change color, then it must return the correct * for any AStartCol in 5 to 9 => ANext... = 10 (switch to not modifying at 10)

See also


From the Free Pascal wiki, page "SynEdit Markup", as it stood on 2024-03-12 after a change by Slawek, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.