Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002509 [JEDI VCL] 00 JVCL Components minor always 2005-01-16 01:18 2005-08-10 08:14
Reporter Simes View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version 3.00 BETA 2
Summary 0002509: TJvFindReplace - ReplaceAll doesn't respect WholeWord only
Description Run the code below. Press the Test button, select Whole-Word-Only option, then click replace all. All occurences are replaced, not just the whole word ones.

In procedure ReplaceAll is the line:
  TmpOptions := FReplaceDialog.Options;
Examining TmpOptions with the debugger, it doesn't include frWholeWord.

Similarly for the match case option.
Additional Information unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, JvComponent, JvFindReplace;

type
  TForm1 = class(TForm)
    JvFindReplace1: TJvFindReplace;
    Memo1: TMemo;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
  public
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormShow(Sender: TObject);
begin
  Button1.Caption := 'Reset';
  Button2.Caption := 'Test';
  Button1Click(self);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Memo1.Clear;
  Memo1.Lines.Add('unit main frm;');
  Memo1.Lines.Add('main this main that maintain main');
  Memo1.Lines.Add('a main b');
  Memo1.CaretPos := Point(0, 0);
  Memo1.SetFocus;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  JvFindReplace1.Options := [frDown];
  JvFindReplace1.EditControl := Memo1;
  JvFindReplace1.FindText := 'main';
  JvFindReplace1.ReplaceText := 'abcd';
  JvFindReplace1.Replace;
end;

end.
Tags No tags attached.
Attached Files

- Relationships
related to 0002515resolvedobones Modified TJvFindReplace source to correct issues 2503, 2504, 2513 

-  Notes
(0006149)
Simes (reporter)
2005-01-16 01:29
edited on: 2005-01-16 01:31

Suggested change to TJvFindReplace.DoOnReplace
(This fixes the problem with the options being incorrect in ReplaceAll, but it still doesn't replace the correct occurences.)
...
  if frReplaceAll in TFindDialog(Sender).Options then begin
    SetFindText(FReplaceDialog.FindText);
    SetReplaceText(FReplaceDialog.ReplaceText);
    SetOptions(FReplaceDialog.Options); //<----- add this line
    ReplaceAll(FFindText, FReplaceText);
    if Assigned(FOnReplace) then
      FOnReplace(Self);
  end
...

(0006160)
Simes (reporter)
2005-01-16 13:06

See 2515 - it has a modified version of this component.

- Issue History
Date Modified Username Field Change
2005-01-16 01:18 Simes New Issue
2005-01-16 01:29 Simes Note Added: 0006149
2005-01-16 01:31 Simes Note Edited: 0006149
2005-01-16 13:06 Simes Note Added: 0006160
2005-01-17 03:15 obones Relationship added related to 0002515
2005-08-10 08:14 obones Status new => resolved
2005-08-10 08:14 obones Resolution open => fixed
2005-08-10 08:14 obones Assigned To => obones


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker