Selected Text Color

Yaron
2012-09-13
2012-11-13
  • Yaron

    Yaron - 2012-09-13

    Changing the Selected Text FORGROUND Color doesn't have any effact.

    I'd be glad to know how to fix it.

    Thank you.

     
  • nofun

    nofun - 2012-09-13

    Maybe you should file a bug report.

    But as a workaround you can have a script for NppExec or PythonScript plugins, which will be executed on N++'s startup to change the colour with SCI_SETSELFORE message.

     
  • cchris

    cchris - 2012-09-16

    You can't, this is not a phpBB powered forum.
    As a moderator I can only delete posts, but not edit them either.
    CChris

     
  • Yaron

    Yaron - 2012-09-17

    Thank you CChris.

     
  • Simon Young

    Simon Young - 2012-09-19

    At the moment only the selection background (SCI_SETSELBACK) colour is read from stylers.xml by the code in:

    PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp (Lines 2079 to 2088 in V6.1.8)

    A section has to be added to read the foreground colour (SCI_SETCARETFORE) and it looks like this:

    COLORREF caretColor = black;
    i = stylers.getStylerIndexByID(SCI_SETCARETFORE);
    if (i != -1)
    {
        Style & style = stylers.getStyler(i);
        caretColor = style._fgColor;
    }
    execute(SCI_SETCARETFORE, caretColor);
    

    There also has to be a change this line in stylers.xml from:

    <WidgetStyle name="Selected text colour" styleID="0" bgColor="C0C0C0" />

    to:

    <WidgetStyle name="Selected text colour" styleID="0" bgColor="C0C0C0" fgColor="000000" />

    I've submitted a patch for these modifications (ID:3569544).

     
  • Simon Young

    Simon Young - 2012-09-19

    Whoops,

    The code segment in 6 should be this:

    COLORREF selectColorFore = black;
    i = stylers.getStylerIndexByName(TEXT("Selected text colour"));
    if (i != -1)
    {
        Style & style = stylers.getStyler(i);
        selectColorFore = style._fgColor;
    }
    execute(SCI_SETSELFORE, 1, selectColorFore);
    

    The change to stylers.xml is correct as is the patch.

     
  • Yaron

    Yaron - 2012-09-19

    Thank you nppuser56.

    Excuse my ignorance.
    Do I need to download the source files, change the code and recompile?
    Could you please recommend on a simple lightweight compiler?

    I appreciate your help.

     
  • Simon Young

    Simon Young - 2012-09-19

    @yaron12:

    If you want to make the changes yourself then you will have to download the source code, change the code & recompile.

    As far as I know the code is designed to be compiled by Microsoft Visual Studio. That's what I use though I wouldn't call it lightweight.

    There is a free version (called Visual Studio Express) which can be downloaded from the Microsoft web-site though I haven't tried this so I don't know how well it works.

    I was hoping that the code-base would be updated to include the new functionality when I submitted the patch.

     
  • Yaron

    Yaron - 2012-09-20

    Thanks for the detailed explanation. I really appreciate it.

    I guess I'll wait for your patch to be included in the code-base. Thanks for your work.

    Best regards.