[Patch] TSynEdit Change request in TSynGutterLineNumber component. Add event OnGetText.
Original Reporter info from Mantis: DomingoGP @DomingoGP
-
Reporter name: Domingo Galmés
Original Reporter info from Mantis: DomingoGP @DomingoGP
- Reporter name: Domingo Galmés
Description:
This patch adds an event to customize the line number text in the TSynedit gutter line number.
The motivation for the change is to be used in a utility to compare files where the line numbers of the editor do not match the line numbers of the original file (there may be lines added or deleted).
This change allows the user of the TSynEdit component full control over the text of the editor line number part of the gutter.
Besides adding the OnGetText event I have changed the FormatLineNumber function from private to public to be able to use it in the event routine.
Example of using the proposed changes.
procedure TForm1.SynGutterLineNumber1GetText (Sender: TSynGutterLineNumber;
ALine: integer; var AText: string; AIsDot: boolean);
begin
if aLine <= 3 then
AText: = '-'
else
AText: = Sender.FormatLineNumber (ALine - 3, AIsDot);
end;
I hope you can apply these changes.
Steps to reproduce:
The project1.zip contains a sample project to test the changes.
Mantis conversion info:
- Mantis ID: 38370
- Fixed in version: 2.2
- Fixed in revision: 64426 (#299edb53)
- Target version: 2.2