Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-05

SynEdit1.SearchReplace(

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

CML Christian Hartnick

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

Reply by email

CML Christian Hartnick
to CML Christian Hartnick

Sorry for the quick add-on:

In lazarus seems to be the same error too. (I think it is using the same component).

Christian

CML Christian Hartnick wrote 40 lines
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 -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Martin Frb
to CML Christian Hartnick: this is my first post on this list. I'm a former Delphi programmer now using lazarus. I'm…

can you open a bug report on this please?

I will then look at it as soon as I have time. (I am currently a bit busy, so it may be a while)

CML Christian Hartnick wrote 39 lines
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 -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email