SynEdit: How to make background selection of several text areas defined by start and end positions?

Usage: Delphi XE2, Windows VCL forms application, 32-bit

I am using a SynEdit control to display text. I am already using TSynHTMLSyn syntax with a control to properly highlight HTML and JS code.

I also understand this text (using Angus Johnson TDiff) with a different version of the text to find: deletions, additions and changes. I need to highlight each of these types of changes with a different color, for example RED for deletion, BLUE for add-ons, and GREEN for changes.

My questions:

  • Is it possible to implement?
  • If so, how?

TIA.

+6
source share
1 answer

Try using the TSynEdit.onSpecialLineColors event, for example

procedure TfmRunScript.EditorSpecialLineColors(Sender: TObject; Line: Integer; var Special: Boolean; var FG, BG: TColor); begin if Line = ErrorLine then begin Special := True; BG := clMaroon; FG := clWhite; end; end; 
+1
source

Source: https://habr.com/ru/post/957006/


All Articles