Hi,
I changed the selection color in 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](https://github.com/geany/geany/assets/169445053/a592aa0d-e4cc-460a-bafc-c889...) ![Find_Dialog_Box_Closed](https://github.com/geany/geany/assets/169445053/86216a4e-137f-41d6-b3ba-9a69...)
Regards, Amit
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.
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](https://github.com/geany/geany/assets/169445053/6995955a-ef9c-41b8-893c-66a4...) ![After_Closing_Popup](https://github.com/geany/geany/assets/169445053/50504618-2969-4bbc-a789-6205...)
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?
Yes, I am running Geany on Windows 10. I have now put this information in my original post also.
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?
My main issue is this: I keep the Find dialog box open to search for the text. I don't want to close the Find box. So, when I click Next on the Find box, it moves to the next matched item but it is not highlighting the matched text in the color that I gave in the selection variable settings.
It is highlighting in silver color (0xc0c0c0) but the text is black in the default theme, and since these two colors are not very contrasting, the text is almost not visible. I have to go very close to the screen to see the matched text (since I searched using a regex pattern, so I don't know in advance that what all will be matched).
Also, it looks like 0xc0c0c0 is hardcoded somewhere in the code. But in the default theme the text is black, so the choice of 0xc0c0c0 color is not good.
Regards, Amit
@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](https://www.scintilla.org/ScintillaDoc.html#SC_ELEMENT_SELECTION_INACTIVE_TE...), 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.
So, it looks like I will have to live with this.
I have worked other editors also (vim, netbeans, etc.) and other software also but I never noticed this kind of thing - greying out selection if the edit pane is not in focus.
May be some other editors also do it but it looks like they don't make it grey, but some other color so that the selected text is still visible and that's why I didn't notice it.
So, in my opinion, I think Scintilla chose the wrong color because, in most of the cases, the text is black. May be they should have chosen light blue.
Regards, Amit
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.
Hi,
In my issue there is no case of dimming.
I open the Find box. There is no selection right now. I click next on the find box and the text is highlighted in grey.
I haven't observed this behaviour in MS Word, Notepad, Netbeans, etc.
In notepad, the matched text is highlighted in blue while the find box is still open and the find box has the focus.
If a popup opens then you can dim the current selection.
But if the job of the popup is to highlight text then it should use some contrasting color because in most of the cases the text is black/dark. Even in dark mode, it is not necessary that the text will be in white. I have tried some dark themes in Geany but I like the default theme more than other themes.
Regards, Amit
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.
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 with light blue color (0xADD8E6). This can be easily done and the light blue color will work in majority of cases. I think grey color doesn't work 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
The default unfocused selection style is part of [Scintilla](https://www.scintilla.org/), 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.
Can this issue and all the posts in this issue be deleted as this issue can't be solved.
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.
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.
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) 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.
I don't have enough time to make lots of changes.
I can change 0xc0c0c0 to light blue using Scintilla API.
Can someone ask Geany's development team whether they will accept this change?
Regards, Amit
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 code now.
Regards, Amit
github-comments@lists.geany.org