[Lazarus] SynEdit1.SearchReplace(

CML Christian Hartnick cml at postkammer.de
Mon May 26 17:42:52 CEST 2014


Hi,

this is my first post on this list. I'm a former Delphi programmer now 
using lazarus. I'm writing an html generator and using the synedit 
component.

When I'm searching and/or replacing with the "SynEdit1.SearchReplace()" 
function, there is a strange behavior if the search string is #10 (to 
search a word at the beginning/end). The function selects not only the 
linefeed - it selects the whole line above, too. In case of an 
replacement the line will be deleted!

procedure TfrmMain.ReplaceDialog1Replace(Sender: TObject);
var srOptions: TSynSearchOptions;
begin
   srOptions:=[ssoReplace,ssoPrompt];
   if not (frDown    in ReplaceDialog1.Options) then 
Include(srOptions,ssoBackwards);
   if (frMatchCase   in ReplaceDialog1.Options) then 
Include(srOptions,ssoMatchCase);
   if (frWholeWord   in ReplaceDialog1.Options) then 
Include(srOptions,ssoWholeWord);
   if (frReplaceAll  in ReplaceDialog1.Options) then 
Include(srOptions,ssoReplaceAll);
   if (frEntireScope in ReplaceDialog1.Options) then 
Include(srOptions,ssoEntireScope);
SynEdit1.SearchReplace(ReplaceDialog1.FindText,ReplaceDialog1.ReplaceText,srOptions);
end;

thanx

Christian




More information about the Lazarus mailing list