View Issue Details

IDProjectCategoryView StatusLast Update
0025108PatchesPackagespublic2013-09-29 11:08
ReporterDenis Golovan Assigned ToMartin Friebe  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Target Version1.4Fixed in Version1.3 (SVN) 
Summary0025108: [SynEdit] case-sensivity support in caret highlighting
DescriptionHi

Please apply the attached patch to allow caret highlighting like following:
FEditor.MarkupHighCaret.SearchOptions:=[ssoMatchCase];
TagsNo tags attached.
Fixed in Revision43009
LazTarget1.4
Widgetset
Attached Files

Activities

Denis Golovan

2013-09-28 12:12

reporter  

synedit_casesensitivity.patch (798 bytes)   
diff --git a/components/synedit/syneditmarkuphighall.pp b/components/synedit/syneditmarkuphighall.pp
index ef234d0..81df0db 100644
--- a/components/synedit/syneditmarkuphighall.pp
+++ b/components/synedit/syneditmarkuphighall.pp
@@ -1704,6 +1704,7 @@ begin
   fSearch.Whole     := ssoWholeWord in fSearchOptions;
   fSearch.RegularExpressions := ssoRegExpr in fSearchOptions;
   fSearch.RegExprMultiLine   := ssoRegExprMultiLine in fSearchOptions;
+  fSearch.Sensitive:=ssoMatchCase in fSearchOptions;
   fSearch.Backwards := False;
 end;
 
@@ -2743,6 +2744,8 @@ begin
       Result := []
     else
       Result := [ssoWholeWord];
+  if ssoMatchCase in SearchOptions then
+    Result := Result + [ssoMatchCase];
 end;
 
 constructor TSynEditMarkupHighlightAllCaret.Create(ASynEdit: TSynEditBase);

Martin Friebe

2013-09-28 12:51

manager   ~0070421

The first part of the patch (line 1707) duplicates an already existing line. It is not needed.


Previously GetCurrentOption did not depend on inherited options. So it could store FToggledOption.
Now FToggledOption must be updated, if inherited options change.

Hint:
 TSynEditMarkupHighlightAll.SetSearchOptions should call "DoOptionsChanged; virtual" which can be overridden to update FToggledOption.

Denis Golovan

2013-09-28 13:52

reporter   ~0070424

I see your point.
You are right.

The only thing I don't quite understand - should I change FToggleOption like following:

procedure TSynEditMarkupHighlightAllCaret.DoOptionsChanged;
begin
  if ssoMatchCase in SearchOptions then
    FToggledOption:=FToggledOption + [ssoMatchCase]
    else
    FToggledOption:=FToggledOption - [ssoMatchCase];
end;

Martin Friebe

2013-09-28 14:19

manager   ~0070427

yes, that looks alright

Denis Golovan

2013-09-28 14:34

reporter  

synedit_casesensitivity2.patch (1,982 bytes)   
diff --git a/components/synedit/syneditmarkuphighall.pp b/components/synedit/syneditmarkuphighall.pp
index ef234d0..13e5f05 100644
--- a/components/synedit/syneditmarkuphighall.pp
+++ b/components/synedit/syneditmarkuphighall.pp
@@ -180,6 +180,7 @@ type
     procedure SetSearchString(AValue: String);
   protected
     procedure SearchStringChanged; virtual;
+    procedure DoOptionsChanged;virtual;
 
     function  HasSearchData: Boolean; override;
     function  SearchStringMaxLines: Integer; override;
@@ -413,6 +414,7 @@ type
     procedure DoCaretChanged(Sender: TObject); override;
     procedure DoTextChanged(StartLine, EndLine, ACountDiff: Integer); override;
     procedure DoMarkupChanged(AMarkup: TSynSelectedColor); override;
+    procedure DoOptionsChanged;override;
     procedure RestartTimer;
     procedure ScrollTimerHandler(Sender: TObject);
     function  GetCurrentText: String;
@@ -1638,6 +1640,7 @@ begin
   fSearchOptions := AValue;
   FSearchStringMaxLines := -1;
   Invalidate;
+  DoOptionsChanged;
 end;
 
 procedure TSynEditMarkupHighlightAll.SetSearchString(AValue: String);
@@ -1655,6 +1658,11 @@ begin
   //
 end;
 
+procedure TSynEditMarkupHighlightAll.DoOptionsChanged;
+begin
+  //
+end;
+
 function TSynEditMarkupHighlightAll.HasSearchData: Boolean;
 begin
   Result := FSearchString <> '';
@@ -2732,6 +2740,14 @@ begin
   end;
 end;
 
+procedure TSynEditMarkupHighlightAllCaret.DoOptionsChanged;
+begin
+  if ssoMatchCase in SearchOptions then
+    FToggledOption:=FToggledOption + [ssoMatchCase]
+    else
+    FToggledOption:=FToggledOption - [ssoMatchCase];
+end;
+
 function TSynEditMarkupHighlightAllCaret.GetCurrentOption: TSynSearchOptions;
 begin
   if FToggledWord <> '' then
@@ -2743,6 +2759,8 @@ begin
       Result := []
     else
       Result := [ssoWholeWord];
+  if ssoMatchCase in SearchOptions then
+    Result := Result + [ssoMatchCase];
 end;
 
 constructor TSynEditMarkupHighlightAllCaret.Create(ASynEdit: TSynEditBase);
synedit_casesensitivity2.patch (1,982 bytes)   

Denis Golovan

2013-09-28 14:34

reporter   ~0070429

See version 2.

Martin Friebe

2013-09-28 15:16

manager   ~0070430

Thanks. Applied in 43009

Added you to contributors list.

Denis Golovan

2013-09-29 11:08

reporter   ~0070438

Thanks.

Issue History

Date Modified Username Field Change
2013-09-28 12:12 Denis Golovan New Issue
2013-09-28 12:12 Denis Golovan File Added: synedit_casesensitivity.patch
2013-09-28 12:27 Martin Friebe Assigned To => Martin Friebe
2013-09-28 12:27 Martin Friebe Status new => assigned
2013-09-28 12:51 Martin Friebe Note Added: 0070421
2013-09-28 13:52 Denis Golovan Note Added: 0070424
2013-09-28 14:19 Martin Friebe Note Added: 0070427
2013-09-28 14:34 Denis Golovan File Added: synedit_casesensitivity2.patch
2013-09-28 14:34 Denis Golovan Note Added: 0070429
2013-09-28 15:16 Martin Friebe Fixed in Revision => 43009
2013-09-28 15:16 Martin Friebe LazTarget => 1.4
2013-09-28 15:16 Martin Friebe Note Added: 0070430
2013-09-28 15:16 Martin Friebe Status assigned => resolved
2013-09-28 15:16 Martin Friebe Fixed in Version => 1.3 (SVN)
2013-09-28 15:16 Martin Friebe Resolution open => fixed
2013-09-28 15:16 Martin Friebe Target Version => 1.4
2013-09-29 11:08 Denis Golovan Note Added: 0070438
2013-09-29 11:08 Denis Golovan Status resolved => closed