Recent

Author Topic: TSynEdit compare 2 memo text (TSynDiffSyn?)  (Read 3265 times)

dr4cul453xy

  • New member
  • *
  • Posts: 7
TSynEdit compare 2 memo text (TSynDiffSyn?)
« on: June 12, 2017, 07:25:34 pm »
Does anyone know how to compare 2 memo using SynEdit? I have tried (hard) to search on the net to get the sample code but yet have no luck. Also found TDiff by Angus Johnson (http://www.angusj.com/delphi/textdiff.html) and still studying the sample (I found it a bit hard to understand, especially implementing highlighting).

Thanks in advance for the help ::)
drx

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9907
  • Debugger - SynEdit - and more
    • wiki
Re: TSynEdit compare 2 memo text (TSynDiffSyn?)
« Reply #1 on: June 12, 2017, 09:34:10 pm »
SynEdit does not actually have any code to compute diffs.

TSynDiffSyn is a highlighter, that can be used if you have the result of the linux "diff" command.

That is, if you put text like below in a SynEdit
Code: Diff  [Select][+][-]
  1.   foo
  2. + bar
  3. - abc
  4.   123
  5.  
Then that text is highlighted.

So you need another component to compute the diff. (Sorry, I don't know of any)

dr4cul453xy

  • New member
  • *
  • Posts: 7
Re: TSynEdit compare 2 memo text (TSynDiffSyn?)
« Reply #2 on: June 12, 2017, 10:02:11 pm »
Hi Martin,

Thank you for your explanation, I will try to use TDiff then.

Regards,
Drx
drx

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: TSynEdit compare 2 memo text (TSynDiffSyn?)
« Reply #3 on: June 12, 2017, 10:19:38 pm »
Mattias has written diff functionality for the Lazarus IDE accessed via Tools > Compare files... which shows the Compare Files (not for creating patches) dialog.
The source for the diff engine is in
  ../lazarus/ide/diffpatch.pas
and the source for the dialog is in
  ../lazarus/ide/diffdialog.pas

 

TinyPortal © 2005-2018