Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection color changed in default theme but the changed color doesn't take effect if the "Find" dialog box is open. The changed color takes effect only when the "Find" dialog box is closed. #3874

Open
ghost opened this issue May 17, 2024 · 19 comments
Labels

Comments

@ghost
Copy link

ghost commented May 17, 2024

Hi,

I am running Geany on Windows 10 and I am using default theme of Geany.

I changed the selection color in the default theme (File: data\filedefs\filetypes.common) but the changed color doesn't take effect if the "Find" dialog box is open. The changed color takes effect only when the "Find" dialog box is closed.

Here is my change:

-selection=0x000000;0xc0c0c0;false;true
+selection=0x000000;0x00ff00;false;true

I have captured the above issue in two images that I am attaching here.

Question: Is there some solution that the changed color should be applied even if the "Find" dialog box is open?

Find_Dialog_Box_Open
Find_Dialog_Box_Closed

Regards,
Amit

@elextr
Copy link
Member

elextr commented May 17, 2024

Works for me, Geany 2.0, the text found by the find dialog changes colour immediately filetypes.common is saved, even with the find dialog open.

@ghost
Copy link
Author

ghost commented May 17, 2024

I also have Geany 2.0. My build is "(built on or after 2023-10-19)". Can you please check your build-date?

You can see this in Menu (Help->About).

During this process, I also found that when the About popup opens, the selection color changes back.

I am attaching two screenshots.

So, it looks like if any popup is opened, then the changed selection color (green) is reverted back (to silver) and when the popup is closed then the selection color changes back to the changed selection color (green).

I am attaching the screenshots.

So, it looks like this issue is related to popups in general.

Any_Popup_Opened_Changes_Color_Back
After_Closing_Popup

@elextr
Copy link
Member

elextr commented May 17, 2024

This Geany is built from a month or so old Git.

But I am on Linux and I see you are on Windows, maybe its something about GTK and Windows?

@elextr elextr added the windows label May 17, 2024
@ghost
Copy link
Author

ghost commented May 17, 2024

Yes, I am running Geany on Windows 10. I have now put this information in my original post also.

@eht16
Copy link
Member

eht16 commented May 19, 2024

Could it be that the selection color just changes when the find dialog is open because the focus is set from the Geany main window to the find dialog?
At least, I see similar behaviour on Linux as well.

If so, this is not a problem at all but rather normal behavior and not related to the find dialog.

To verify, @amit-choudhary-0523 does it also happen when you click into the search field in the toolbar? Or when opening any other dialog?

@ghost
Copy link
Author

ghost commented May 19, 2024 via email

@elextr
Copy link
Member

elextr commented May 19, 2024

@eht16 has pointed out the reason you don't see the selection colour, you still have the focus on the find dialog, so the edit pane does not have focus, and Scintilla makes the selection grey when the edit pane is not focused.

There is a fairly new API that allows changing the unfocused styling, so I'm not sure its available in the version Geany uses, but when it is "somebody" can add elements to the filetypes.common to change it.

In the meantime you will have to focus the edit pane to see the selected style.

@ghost
Copy link
Author

ghost commented May 19, 2024 via email

@elextr
Copy link
Member

elextr commented May 19, 2024

There is no background that is always right, thats why Scintilla has made it settable I guess. But the grey has sufficient contrast with black on white text and white on black text (on my monitor with my eyes, YMMV).

Dimming the selection when not focused is a common idiom on Windows, and (IIUC) on Macos. Scintilla tries to work roughly the same on all platforms. The operative word is "dim", to become less conspicuous when unfocused, is the point of the feature, so choosing a bright colour is inappropriate for that use-case.

Other cross platform applications that come from platforms other than Linux dim it, eg Vscode. Vim is Unix and from a terminal background where multiple windows do not exist so the feature was originally impossible, and Hasbeens is a Java Swing application IIUC which is Sun/Oracle Unix.

@ghost
Copy link
Author

ghost commented May 20, 2024 via email

@elextr
Copy link
Member

elextr commented May 20, 2024

I click next on the find box and the text is highlighted in grey.

The found text is not simply highlighted, it is selected, so what is shown is the unfocused selection style, which as above is hard coded to #xc0c0c0.

In notepad, the matched text is highlighted in blue

So Notepad either simply highlights the found text in blue, which is not focus dependent, or uses a new enough Scintilla that the unfocused selection style setting is available and is set to blue.

Bottom line is, as I said above, if/when Geany uses a new enough Scintilla it will be possible to add settings to filetypes.common for unfocused (inactive) selection so anybody or any colour scheme can set its own.

But Geany is a totally volunteer project so "somebody" has to do it.

@ghost
Copy link
Author

ghost commented May 20, 2024

Yes, someone has to do it.

Yet, in my opinion, there is a simple workaround that will work in majority of cases. Change the hardcoded grey color to light blue color (0xADD8E6). This can be easily done and the light blue color should work in majority of cases.

I don't think that grey color works in majority of cases - it doesn't work on black/dark text, it doesn't work on green text of Bespin dark theme, etc.

Regards,
Amit

@elextr
Copy link
Member

elextr commented May 20, 2024

The default unfocused selection style is part of Scintilla, that is another project, its not Geany code. Geany uploads Scintilla code unmodified, we do not have the resources to maintain patches for it.

You may try to have Scintilla change that default, but since the current Scintilla version has an API for setting it, I doubt it will be accepted.

@ghost
Copy link
Author

ghost commented May 20, 2024

Can this issue and all the posts in this issue be deleted as this issue can't be solved.

@eht16
Copy link
Member

eht16 commented May 20, 2024

It can be solved.

The mentioned Scintilla API is already available in the GIT master version of Geany. So we need to use it and probably add some new styles for inactive selection text.

It still needs someone willing to do it but it's possible.

@ghost
Copy link
Author

ghost commented May 20, 2024

I am willing to make changes in Geany code to change the hardcoded color 0xc0c0c0 to light blue using the Scintilla API. If my changes will be accepted (obviously, after review, tests, etc.) then please let me know.

Although I can search the code, but if someone tells me where all to make the changes then it will be great. At least, I would like someone to tell me which Scintilla API to use.

@elextr
Copy link
Member

elextr commented May 20, 2024

My basic search of issues does not show any other complaints with this background colour, so simply replacing one default with another is unlikely to be accepted. It would need to be a setting in filetypes.common (and possibly overrides from colour schemes) so it can be set by users or colour schemes. Then you can set anything you want :-)

Thanks for offering to help, probably the best way to start (when you have a working build of a Geany git clone, see HACKING) might be to copy the selection style handling that is already there but of course use the new API to Scintilla. I assume the new and old API can be mixed, it does not seem to be excluded by the Scintilla docs AFAICT, but if not then some further changes might be needed to move everything to the new API.

@ghost
Copy link
Author

ghost commented May 20, 2024 via email

@ghost
Copy link
Author

ghost commented May 20, 2024

Now I have decided not to use Geany anymore because the basic search text highlighting stuff is not working according to my expectations.

Also, I won't be making changes to Geany's code now.

Regards,
Amit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants