#964 Highlight line not shown when window inactive

Completed
closed
Neil Hodgson
Scintilla (356)
5
2013-01-17
2012-12-05
Vidya Wasi
No

Please add option to show highlight lines even when the window is not in focus.

This is the code notepad2 use for highlight current line, to better show what i'm talking about:
void Style_SetCurrentLineBackground(HWND hwnd)
{
int rgb, iValue;

// Use 2nd default style
int iIdx = (bUse2ndDefaultStyle) ? 12 : 0;

if (bHiliteCurrentLine) {

if (Style_StrGetColor(FALSE,lexDefault.Styles[8+iIdx].szValue,&rgb)) // caret line back
{
SendMessage(hwnd,SCI_SETCARETLINEVISIBLE,TRUE,0);
SendMessage(hwnd,SCI_SETCARETLINEBACK,rgb,0);

if (Style_StrGetAlpha(lexDefault.Styles[8+iIdx].szValue,&iValue))
SendMessage(hwnd,SCI_SETCARETLINEBACKALPHA,iValue,0);
else
SendMessage(hwnd,SCI_SETCARETLINEBACKALPHA,SC_ALPHA_NOALPHA,0);
}
else
SendMessage(hwnd,SCI_SETCARETLINEVISIBLE,FALSE,0);
}
else
SendMessage(hwnd,SCI_SETCARETLINEVISIBLE,FALSE,0);
}

Discussion

  • Vidya Wasi
    Vidya Wasi
    2012-12-06

    I've made a patch for this feature.

    Added two messages:
    SCI_GETCARETLINEVISIBLEALWAYS
    SCI_SETCARETLINEVISIBLEALWAYS

    Will make it show the caret line always even when the window is inactive.
    Default setting is off,

    This could be further extended. Like adding support for a different caret line color when the window is inactive.

    Note: The patch file was made with git.

     
  • Vidya Wasi
    Vidya Wasi
    2012-12-06

    The patch was made based on scintilla v3.2.3

     
  • Neil Hodgson
    Neil Hodgson
    2012-12-30

    The Scintilla.h file is generated from Scintilla.iface, so that is the file that should be modified and it should include short explanatory comments. The patch should also include documentation in doc/ScintillaDoc.html.

    The 4000+ range is for lexer related messages. The next message number for other features is 2654.

    Extension to different colours for inactive is not needed as the application can switch the colour when it receives a focus notification.

     
  • Neil Hodgson
    Neil Hodgson
    2012-12-30

    • assigned_to: nobody --> nyamatongwe
     
  • Vidya Wasi
    Vidya Wasi
    2012-12-31

    ver 2, based on scintilla v3.2.3, patch made with git

     
  • Vidya Wasi
    Vidya Wasi
    2012-12-31

    I've uploaded a new patch.
    Does it satisfy your requirements ?

     
  • Neil Hodgson
    Neil Hodgson
    2013-01-01

    Committed.

     
  • Neil Hodgson
    Neil Hodgson
    2013-01-01

    • milestone: --> Completed
     
  • Neil Hodgson
    Neil Hodgson
    2013-01-17

    • status: open --> closed