View Issue Details

IDProjectCategoryView StatusLast Update
0026257LazarusPackagespublic2014-11-13 15:36
ReporterAlexey Tor.Assigned ToMartin Friebe 
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product Version1.2.2Product Build 
Target Version1.4Fixed in Version1.3 (SVN) 
Summary0026257: SynEdit: more customizing for caret width
DescriptionNotepad++ has option for caret: 1pix line, 2px line, 3px line.


So option InsertCaret needs more values:

VerticalLine (as is, for back compat)
VerticalLineX1 (1px line - like Notepad++, Notepad, EmEditor)
VerticalLineX2 (2xp line)
VerticalLineX3 (3px)

Enougth 1px..3px
TagsNo tags attached.
Fixed in Revision46833
LazTarget1.4
Widgetset
Attached Files
  • caret.txt (812 bytes)
    SynEditPointClasses.pas
    
    a- change type
      TSynCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfBlock, ctBlock,
        ctVerticalLineX1, ctVerticalLineX2, ctVerticalLineX3);
    
    b-
    procedure TSynEditScreenCaret.UpdateDisplayType;         
    at begin of 
      case FDisplayType of        
    change
    
      case FDisplayType of
        ctVerticalLine,
        ctVerticalLineX1,
        ctVerticalLineX2,
        ctVerticalLineX3:
          begin
            case FDisplayType of
              ctVerticalLineX1:
                FPixelWidth := 1;
              ctVerticalLineX3:
                FPixelWidth := 3;
              else
                FPixelWidth := 2;
            end;
            FPixelHeight    := FCharHeight - 2;
            FOffsetX        := -1;
            FOffsetY        :=  1;
            FExtraLinePixel :=  1;
          end;
        ctBlock:   
        
    caret.txt (812 bytes)
  • caret.diff (1,126 bytes)
    --- syneditpointclasses-122.pas	Sat Oct 12 12:07:34 2013
    +++ syneditpointclasses.pas	Mon Jun 02 02:10:48 2014
    @@ -316,7 +316,8 @@
         property MaxLeftChar: TMaxLeftCharFunc write FMaxLeftChar;
       end;
     
    -  TSynCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfBlock, ctBlock);
    +  TSynCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfBlock, ctBlock,
    +    ctVerticalLineX1, ctVerticalLineX2, ctVerticalLineX3);
       TSynCaretLockFlags = set of (sclfUpdateDisplay, sclfUpdateDisplayType);
     
       { TSynEditScreenCaret }
    @@ -2297,9 +2298,19 @@
       Exclude(FLockFlags, sclfUpdateDisplayType);
     
       case FDisplayType of
    -    ctVerticalLine:
    +    ctVerticalLine,
    +    ctVerticalLineX1,
    +    ctVerticalLineX2,
    +    ctVerticalLineX3:
           begin
    -        FPixelWidth     := 2;
    +        case FDisplayType of
    +          ctVerticalLineX1:
    +            FPixelWidth := 1;
    +          ctVerticalLineX3:
    +            FPixelWidth := 3;
    +          else
    +            FPixelWidth := 2;
    +        end;
             FPixelHeight    := FCharHeight - 2;
             FOffsetX        := -1;
             FOffsetY        :=  1;
    
    caret.diff (1,126 bytes)
  • diff2.zip (1,584 bytes)

Activities

Bart Broersma

2014-06-01 22:42

developer   ~0075396

> So option InsertCaret needs more values
Needs? Because of what? Because you want it to?
Feel free to provide a patch then.

Alexey Tor.

2014-06-01 23:13

reporter  

caret.txt (812 bytes)
SynEditPointClasses.pas

a- change type
  TSynCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfBlock, ctBlock,
    ctVerticalLineX1, ctVerticalLineX2, ctVerticalLineX3);

b-
procedure TSynEditScreenCaret.UpdateDisplayType;         
at begin of 
  case FDisplayType of        
change

  case FDisplayType of
    ctVerticalLine,
    ctVerticalLineX1,
    ctVerticalLineX2,
    ctVerticalLineX3:
      begin
        case FDisplayType of
          ctVerticalLineX1:
            FPixelWidth := 1;
          ctVerticalLineX3:
            FPixelWidth := 3;
          else
            FPixelWidth := 2;
        end;
        FPixelHeight    := FCharHeight - 2;
        FOffsetX        := -1;
        FOffsetY        :=  1;
        FExtraLinePixel :=  1;
      end;
    ctBlock:   
    
caret.txt (812 bytes)

Alexey Tor.

2014-06-01 23:15

reporter   ~0075397

Don't be rude...Is this patch OK? I tested. I don't know how to make diff and i have 1.2.2 maybe diff is not ok for 1.2.x

Martin Friebe

2014-06-01 23:49

manager   ~0075398

I think, it be better to only have ctCustom
and specify the dimensions and offset.

Though, maybe just specify the LineWidth and have one ctVerticalLine
LineWidth can apply to horiz or vert.


In any case, it will be a few weeks (at least) before I can look at anything.

Bart Broersma

2014-06-01 23:49

developer   ~0075399

Can you provide a diff against trunk?
Alternatively (if you do not have trunk) you can use the diff that comes with fpc:
diff -u original_file modified_file

Martin Friebe

2014-06-02 00:10

manager   ~0075400

@Bart: If you want to apply, the general location is fine.

But don't apply 3 enums, Have ONE integer property for CarePixelWidth

As for me, I dont need a patch to do it, but I have other work now / So I will do in a couple of weeks.

Alexey Tor.

2014-06-02 00:15

reporter  

caret.diff (1,126 bytes)
--- syneditpointclasses-122.pas	Sat Oct 12 12:07:34 2013
+++ syneditpointclasses.pas	Mon Jun 02 02:10:48 2014
@@ -316,7 +316,8 @@
     property MaxLeftChar: TMaxLeftCharFunc write FMaxLeftChar;
   end;
 
-  TSynCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfBlock, ctBlock);
+  TSynCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfBlock, ctBlock,
+    ctVerticalLineX1, ctVerticalLineX2, ctVerticalLineX3);
   TSynCaretLockFlags = set of (sclfUpdateDisplay, sclfUpdateDisplayType);
 
   { TSynEditScreenCaret }
@@ -2297,9 +2298,19 @@
   Exclude(FLockFlags, sclfUpdateDisplayType);
 
   case FDisplayType of
-    ctVerticalLine:
+    ctVerticalLine,
+    ctVerticalLineX1,
+    ctVerticalLineX2,
+    ctVerticalLineX3:
       begin
-        FPixelWidth     := 2;
+        case FDisplayType of
+          ctVerticalLineX1:
+            FPixelWidth := 1;
+          ctVerticalLineX3:
+            FPixelWidth := 3;
+          else
+            FPixelWidth := 2;
+        end;
         FPixelHeight    := FCharHeight - 2;
         FOffsetX        := -1;
         FOffsetY        :=  1;
caret.diff (1,126 bytes)

Bart Broersma

2014-06-02 00:43

developer   ~0075403

@Martin: I leave it to you.

Alexey Tor.

2014-06-02 03:02

reporter  

diff2.zip (1,584 bytes)

Alexey Tor.

2014-06-02 03:02

reporter   ~0075404

New dif.After work of hour.

Alexey Tor.

2014-11-13 00:50

reporter   ~0079123

Any can apply this patch? Thkx..

Martin Friebe

2014-11-13 15:36

manager   ~0079130

Introduced:
TSynCaretType ctCostum
SetCaretTypeSize(AType: TSynCaretType;AWidth, AHeight, AXOffs, AYOffs: Integer);

You can override all caretTypes, including the existing ones.

Setting AWidth <> 0 will ovverride width AND x-offset

Setting AHeight<> 0 will ovverride height AND y-offset


Overridden values do not follow changes in font size (and also not changes due to zoom), so they need to be updated on any such event.
If you only override AWidth, then height (and x offs) are still adapted to changes.


---
Please test and close if ok

Issue History

Date Modified Username Field Change
2014-06-01 22:17 Alexey Tor. New Issue
2014-06-01 22:42 Bart Broersma Note Added: 0075396
2014-06-01 22:44 Martin Friebe LazTarget => -
2014-06-01 22:44 Martin Friebe Assigned To => Martin Friebe
2014-06-01 22:44 Martin Friebe Status new => assigned
2014-06-01 22:44 Martin Friebe Severity minor => feature
2014-06-01 23:13 Alexey Tor. File Added: caret.txt
2014-06-01 23:15 Alexey Tor. Note Added: 0075397
2014-06-01 23:49 Martin Friebe Note Added: 0075398
2014-06-01 23:49 Bart Broersma Note Added: 0075399
2014-06-02 00:10 Martin Friebe Note Added: 0075400
2014-06-02 00:15 Alexey Tor. File Added: caret.diff
2014-06-02 00:43 Bart Broersma Note Added: 0075403
2014-06-02 03:02 Alexey Tor. File Added: diff2.zip
2014-06-02 03:02 Alexey Tor. Note Added: 0075404
2014-11-13 00:50 Alexey Tor. Note Added: 0079123
2014-11-13 15:36 Martin Friebe Fixed in Revision => 46833
2014-11-13 15:36 Martin Friebe LazTarget - => 1.4
2014-11-13 15:36 Martin Friebe Widgetset Win32/Win64 =>
2014-11-13 15:36 Martin Friebe Note Added: 0079130
2014-11-13 15:36 Martin Friebe Status assigned => resolved
2014-11-13 15:36 Martin Friebe Fixed in Version => 1.3 (SVN)
2014-11-13 15:36 Martin Friebe Resolution open => fixed
2014-11-13 15:36 Martin Friebe Target Version => 1.4