Recent

Author Topic: [SOLVED] Completion box show identifiers in pink colors instead of green  (Read 2528 times)

flowCRANE

  • Hero Member
  • *****
  • Posts: 927
See the first attachment — this is the colors scheme I'm using currently. Previously, I have the background color set to RGB 8-8-8 and the completion box looks like in the second attachment (looks good, as expected). But if i change the editor background color (empty space) to RGB 10-10-10, the completion box renders all identifiers using pink color, as you can see in the third screenshot. I don't know what is going on, why the completion box tries to improve colors (and apparently xor-ing identifier color) since this window should looks the same as the normal source editor window (SynEdit).

Question: which line of the Lazarus source code should I comment out or change in the other way to have green identifiers in the completion box instead of pink ones?

In my opinion, the colors used in the completion box should match those used in the code editor in terms of default behavior. Secondly, there should be an option to set custom colors for the elements of this window, just as you can do for the content of other IDE windows, e.g. Messages, Object Inspector, Form Designer and so on.
« Last Edit: March 27, 2024, 08:38:40 pm by furious programming »
Lazarus 4.0 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL3.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11303
  • Debugger - SynEdit - and more
    • wiki
Re: Completion box show identifiers in pink colors instead of green
« Reply #1 on: March 27, 2024, 02:11:33 pm »
Somewhere in the SynEdit code (I can't find it myself right now) is some code that looks at the diff between fore and background. And if that goes below a threshold....

But IIRC the drop down, is painted by IDE code... So I wouldn't be sure it uses that. But I haven't looked at it in a while.
Afaik unit "SourceEditorProcs"

And if it does anything to the color, then it would have to use "ColorToRGB" first....

From a quick glance: SetFontColor in that unit does compute a diff....

flowCRANE

  • Hero Member
  • *****
  • Posts: 927
Re: Completion box show identifiers in pink colors instead of green
« Reply #2 on: March 27, 2024, 02:40:02 pm »
Afaik unit "SourceEditorProcs"

I don't have such file in the entire Lazarus installation.
Lazarus 4.0 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL3.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11303
  • Debugger - SynEdit - and more
    • wiki
Re: Completion box show identifiers in pink colors instead of green
« Reply #3 on: March 27, 2024, 03:22:03 pm »
Afaik unit "SourceEditorProcs"

I don't have such file in the entire Lazarus installation.

Sorry, didn't copy and paste...

ide/sourceeditprocs.pas

flowCRANE

  • Hero Member
  • *****
  • Posts: 927
Re: Completion box show identifiers in pink colors instead of green
« Reply #4 on: March 27, 2024, 05:22:29 pm »
Ok, I found the usage of the InvertColor function, comment it out and pink color is gone. But the problem is that other colors are also not inverted, so hardcoded colors like clBlack for ctnUnit and ctnUseUnitClearName are invisible, so I have to additionally change them.

Please, do the style configurator for the completion box, similar to the one for the SynEdit. The current solution is poor and irritating.
Lazarus 4.0 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL3.

flowCRANE

  • Hero Member
  • *****
  • Posts: 927
Re: Completion box show identifiers in pink colors instead of green
« Reply #5 on: March 27, 2024, 07:55:00 pm »
Ok, editing done. Wasted two hours but I'm quite happy.
Lazarus 4.0 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL3.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11303
  • Debugger - SynEdit - and more
    • wiki
Re: Completion box show identifiers in pink colors instead of green
« Reply #6 on: March 27, 2024, 08:18:31 pm »
Ok, I found the usage of the InvertColor function, comment it out and pink color is gone. But the problem is that other colors are also not inverted, so hardcoded colors like clBlack for ctnUnit and ctnUseUnitClearName are invisible, so I have to additionally change them.

Please, do the style configurator for the completion box, similar to the one for the SynEdit. The current solution is poor and irritating.

As I said, it's ages since I looked at this. Currently I have no idea what ctnUseUnitClearName is (I have a general inkling, but no concrete idea).

So whatever is broken with ctnUseUnitClearName => please create a bug report.

About the "Invert color" => that is general a required feature. In SynEdit you can have colors which modify only either back or foreground, and then also have an alpha channel. So there always is a chance that it goes black on black... That said in my search this afternoon, I was unable to find that code in SynEdit. And it should be there.
Though, some day, the thresholds should be configurable. But that is "some day...".

So for now, if there is something wrong or missing, other that the invert color => bugtracker please.

flowCRANE

  • Hero Member
  • *****
  • Posts: 927
Re: Completion box show identifiers in pink colors instead of green
« Reply #7 on: March 27, 2024, 08:37:53 pm »
So whatever is broken with ctnUseUnitClearName => please create a bug report.

Everything in this case works as intended. The problem is not the color inversion, but the fact that the colors for the left column are hard-coded, so not only do they not match the user's color scheme, but inverting them can produce completely crap colors (like the pink one I had).

Quote
So for now, if there is something wrong or missing, other that the invert color => bugtracker please.

Currently, the missing element is the style configurator for the completion box. So I don't know if it makes sense to report it in bugtracker.
Lazarus 4.0 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL3.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11303
  • Debugger - SynEdit - and more
    • wiki
Re: Completion box show identifiers in pink colors instead of green
« Reply #8 on: March 27, 2024, 08:44:09 pm »
Currently, the missing element is the style configurator for the completion box. So I don't know if it makes sense to report it in bugtracker.

Yes, please report.

It probably is easy to add. But it's even easier to forget. And if on the tracker, maybe someone else from the team picks it up, before I find the time...

flowCRANE

  • Hero Member
  • *****
  • Posts: 927
Lazarus 4.0 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL3.

 

TinyPortal © 2005-2018