View Issue Details

IDProjectCategoryView StatusLast Update
0038685LazarusIDEpublic2021-04-01 17:53
ReporterCudaText man Assigned ToMartin Friebe  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
OSXubuntu 20.x 
Product Version2.1 (SVN) 
Fixed in Version2.2 
Summary0038685: IDE: default color of Gutter in src editor
DescriptionI attach 2 pics:
1) look with default options (color of Gutter is `BtnFace`). it is bad.
2) look of gutter after I changed color of Gutter to `Form`. it is OK.
please correct the default.
TagsNo tags attached.
Fixed in Revision64896
LazTarget2.2
WidgetsetGTK 2
Attached Files

Activities

CudaText man

2021-03-30 15:39

reporter  

color-btn-face.png (6,960 bytes)   
color-btn-face.png (6,960 bytes)   
color-form.png (7,015 bytes)   
color-form.png (7,015 bytes)   

Martin Friebe

2021-03-30 16:19

manager   ~0129990

The default color for the line-number-part of the gutter is intentionally different from the other parts of the gutter. Anyone disliking this can easily change it. There is no need to change the default.
(Besides, the defaults should probably be hardcoded colors (since most other colors are hardcoded), rather than system colors, so it might be changed into the correct light grey)

However the line number part should be a continuous column. There should be no gaps.

Yet I can not reproduce those gaps. (Please check that your line numbers do not have an "text mark" color set.
Can you please attach your editor options?

CudaText man

2021-03-30 16:40

reporter   ~0129991

>Yet I can not reproduce those gaps. (Please check that your line numbers do not have an "text mark" color set.

no such settings. this was the clean PC installation of Laz.

CudaText man

2021-03-30 16:48

reporter   ~0129992

Martin, you can see repro only on few Linuxes. Try this one
https://xubuntu.org/download/

Martin Friebe

2021-03-30 17:51

manager   ~0129993

Might be a bug in ExtUTF8Out

Please check in a new project, empty form (ensure it is big enough), create an OnPaint event.

Is the red background painted below the text? (full 100 pixel height rectangle)


procedure TForm1.FormPaint(Sender: TObject);
var
  r: TRect;
  a: array[0..4] of integer;
begin
  r.top := 50;
  r.Bottom := 150;
  r.Left := 50;
  r.Right := 250;
  LCLIntf.SetBkColor(canvas.Handle, TColorRef(clRed));
  LCLIntf.SetTextColor(canvas.Handle, TColorRef(clGreen));

  LCLIntf.ExtUTF8Out(canvas.Handle, 50, 50, ETO_OPAQUE or ETO_CLIPPED, @r, pchar('ABC'), 3, nil);

  r.top := 250;
  r.Bottom := 350;
  a[0]:= 10;a[1]:= 10;a[2]:= 10;a[3]:= 10;
  LCLIntf.ExtUTF8Out(canvas.Handle, 50, 250, ETO_OPAQUE or ETO_CLIPPED, @r, pchar('ABC'), 3, @a[0]);
end;

CudaText man

2021-03-30 19:12

reporter   ~0129995

this gives this:

Martin Friebe

2021-03-30 19:57

manager   ~0129996

Ok, the image is as far as I can see 100% ok. (I counted the pixels).

Can you move the 2nd "r.top" from 250 to 150 ? (and adjust the 250 in the ExtUtf8Out too).
=> there should be no gap between the 2 red areas.

If you adjust to 151 there should be exactly 1 pixel gap.

--------------------------------------
You could also test in

components\synedit\syngutterlinenumber.pp
TSynGutterLineNumber.Paint

diff --git a/components/synedit/syngutterlinenumber.pp b/components/synedit/syngutterlinenumber.pp
index 18f79cf5d6..4188d83bd6 100644
--- a/components/synedit/syngutterlinenumber.pp
+++ b/components/synedit/syngutterlinenumber.pp
@@ -268,13 +268,13 @@ procedure TSynGutterLineNumber.Paint(Canvas : TCanvas; AClip : TRect; FirstLine,
     fTextDrawer.Style := MarkupInfo.Style;
     // prepare the rect initially
     rcLine := AClip;
- rcLine.Bottom := AClip.Top;
+ rcLine.Bottom := AClip.Top + 1;
     for i := t + FirstLine to t + LastLine do
     begin
       iLine := ToPos(ViewedTextBuffer.DisplayView.ViewToTextIndexEx(i, LineInfo.LineRange));
       if (iLine < 1) or (iLine > c) then break;
       // next line rect
- rcLine.Top := rcLine.Bottom;
+ rcLine.Top := rcLine.Bottom - 1;
       // Must show a dot instead of line number if
       // line number is not the first, the last, the current line
       // or a multiple of ShowOnlyLineNumbersMultiplesOf


This should just cause a 1 pixel overlap.
=> Note that is not a fix. It could cut off the top of some line numbers in some cases.

Martin Friebe

2021-03-30 20:00

manager   ~0129997

Alternatively to the patch above you could also try
components\synedit\syntextdrawer.pp
procedure TheTextDrawer.ExtTextOut(X, Y: Integer; fuOptions: UINT;

  if HasFrame then // draw background // TODO: only if not default bg color
  begin
    InternalFillRect(FDC, ARect);
    if (fuOptions and ETO_OPAQUE) > 0 then
...

Move the " InternalFillRect(FDC, ARect);" above the "IF HasFrame"

CudaText man

2021-03-30 21:07

reporter   ~0129998

>Can you move the 2nd "r.top" from 250 to 150 ? (and adjust the 250 in the ExtUtf8Out too).
=> there should be no gap between the 2 red areas.

yes, it works like you said.

About patches: why do you suggest me to fix these, w/o testing on Xubuntu, I don't want it

Martin Friebe

2021-03-30 21:13

manager   ~0129999

The patches are not fixes. Just checking if any of them provide some more clue....
It might be a while before I set up on XUbuntu VM.

CudaText man

2021-03-30 22:02

reporter   ~0130000

but I have a clue already: Xubuntu gives different result for clForm and clBtnFace, so IDE needs fix in default color of 'gutter': to clForm.

Martin Friebe

2021-03-30 23:14

manager   ~0130001

How does that fix the gaps between the line-numbers? As long as the line-numbers have different background than the rest of the gutter. (And the different background is intention, and will be kept as default)

Yes (I already hinted at this) clButton is not good. Neither is clForm. Both should be none system colors. Both should be the RGB they currently resolve too.

Martin Friebe

2021-03-30 23:51

manager   ~0130002

CORRECTION.

The default for the line-numbers is actually "not modified" => it uses the same colors as set for the rest of the gutter. (That is currently clBtnFace. )
So there is no color distinction.

This meant I was not seeing the darker text color as an issue, because I assumed this was actually intentional (My own setup has this darker background for the line numbers).
Hence, I was looking at the gaps, rather than the rest.

I will shortly commit a change to make it $F0F0F0

---------------------------------------------
However:
Even with clButtonFace there should be no gaps.

SynEdit should call ColorToRGB => which should always return one and the same color.
Not checked yet, but I guess it is missing this, and Xubuntu uses different colors for ButtonFace depending on the context (text vs fillrect).
I will check that separately.

But even if clButtonFace gets different values, the gaps are still strange.

Could you do one more test please:
Set the gutter backgrount to "color1 of your choice" (use a normal color (clGray, clBlue, ... / no system color)
Set the gutter line number background to "another color of your choice"
Are there gaps?
Thanks

CudaText man

2021-03-31 14:41

reporter   ~0130006

> How does that fix the gaps between the line-numbers?

1) do we need to fix that?
2) did you try to set "line spacing" to 0 in IDE options?

CudaText man

2021-03-31 15:51

reporter   ~0130007

Why do you worry about gaps? IDE option "extra line spacing" -- if it's 0 then no gaps. Default is 1 here.

Martin Friebe

2021-03-31 16:53

manager   ~0130010

Ok so the color is changed. I assume that fixes your issue?

Note that this fix is a coincidence.
I changed the color, because clBtnFace is non a fixed color, rather it can be any color (depends on system setup). So clBtnFace could be bright orange. And that would not go well with the theme at all. Therefore it must be a fixed rgb value (or a named rgb value, such as clSiver).

A fixed RGB by coincidence removes the gaps too. And by coincidence fixes the fact that you get 2 colors for one.


------------------------------
"Gaps" => IMHO yes, but maybe its LCL, or even OS.
Anyway, I just found I can get the gaps on Fedora, so I can look at it myself.

I can reproduce it with plain ExtUtf8Out (using clBtnText). So it is not a SynEdit issue.

CudaText man

2021-03-31 21:32

reporter   ~0130011

cannot check due to blocker
https://forum.lazarus.freepascal.org/index.php?topic=53940.msg399949;topicseen#new

CudaText man

2021-03-31 23:03

reporter   ~0130013

issue is solved, after Laz update.

Martin Friebe

2021-04-01 16:14

manager   ~0130023

Changed color to none sys-color.

Created new issue for bug in ExtUTF8Out 0038692

Issue History

Date Modified Username Field Change
2021-03-30 15:39 CudaText man New Issue
2021-03-30 15:39 CudaText man File Added: color-btn-face.png
2021-03-30 15:39 CudaText man File Added: color-form.png
2021-03-30 16:19 Martin Friebe Assigned To => Martin Friebe
2021-03-30 16:19 Martin Friebe Status new => feedback
2021-03-30 16:19 Martin Friebe LazTarget => -
2021-03-30 16:19 Martin Friebe Note Added: 0129990
2021-03-30 16:40 CudaText man Note Added: 0129991
2021-03-30 16:40 CudaText man Status feedback => assigned
2021-03-30 16:48 CudaText man Note Added: 0129992
2021-03-30 17:51 Martin Friebe Note Added: 0129993
2021-03-30 17:51 Martin Friebe Status assigned => feedback
2021-03-30 19:12 CudaText man Note Added: 0129995
2021-03-30 19:12 CudaText man File Added: Screenshot_2021-03-30_20-12-17.png
2021-03-30 19:12 CudaText man Status feedback => assigned
2021-03-30 19:57 Martin Friebe Note Added: 0129996
2021-03-30 20:00 Martin Friebe Note Added: 0129997
2021-03-30 21:07 CudaText man Note Added: 0129998
2021-03-30 21:13 Martin Friebe Note Added: 0129999
2021-03-30 22:02 CudaText man Note Added: 0130000
2021-03-30 23:14 Martin Friebe Note Added: 0130001
2021-03-30 23:51 Martin Friebe Note Added: 0130002
2021-03-31 14:41 CudaText man Note Added: 0130006
2021-03-31 15:51 CudaText man Note Added: 0130007
2021-03-31 16:53 Martin Friebe Note Added: 0130010
2021-03-31 21:32 CudaText man Note Added: 0130011
2021-03-31 23:03 CudaText man Note Added: 0130013
2021-04-01 16:14 Martin Friebe Status assigned => resolved
2021-04-01 16:14 Martin Friebe Resolution open => fixed
2021-04-01 16:14 Martin Friebe Fixed in Version => 2.2
2021-04-01 16:14 Martin Friebe Fixed in Revision => 64896
2021-04-01 16:14 Martin Friebe LazTarget - => 2.2
2021-04-01 16:14 Martin Friebe Widgetset GTK 2 => GTK 2
2021-04-01 16:14 Martin Friebe Note Added: 0130023
2021-04-01 17:53 CudaText man Status resolved => closed