#646 Brace background with caret line

Bug
open
Scintilla (792)
3
2008-01-22
2008-01-19
Garthex
No

Error introduced with https://sourceforge.net/tracker/index.php?func=detail&aid=1725753&group_id=2439&atid=102439

If you want to highlight braces without a background while SCI_SETCARETLINEVISIBLE is true, you would set the brace background to the document background. The current implementation will set the brace background to white (for example) even if the caret line is visible and a different color (making it always change the background for the brace)

an example fix to this would be the following in Editor::TextBackground():

if (overrideBackground && (((styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) ||
(vsDraw.styles[styleMain].back.allocated.AsLong() == vsDraw.whitespaceBackground.allocated.AsLong())))
return background;

Discussion

  • Garthex

    Garthex - 2008-01-19
    • summary: Brace background with caret line fix --> Brace background with caret line
     
  • Garthex

    Garthex - 2008-01-20

    Logged In: YES
    user_id=1943765
    Originator: YES

    Actually the above code doesn't work in all situations. I believe the following code does:

    if (overrideBackground && (((styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) ||
    (vsDraw.styles[styleMain].back.allocated.AsLong() == vsDraw.styles[ll->bracePreviousStyles[ll->positions[i]==braces[1]?1:0]].back.allocated.AsLong())))
    return background;

     
  • Neil Hodgson

    Neil Hodgson - 2008-01-22
    • priority: 5 --> 3
    • assigned_to: nobody --> nyamatongwe
     
  • Neil Hodgson

    Neil Hodgson - 2008-01-22

    Logged In: YES
    user_id=12579
    Originator: NO

    I'm not sure here but comparing the brace background to the document background seems a bit too 'magic' to me. Possibly an explicit braceHighlightSetsBackground flag.

    BTW, ColourDesired has an operator== which may lead to shorter code than using .allocated.AsLong().

     
  • Garthex

    Garthex - 2008-01-22

    Logged In: YES
    user_id=1943765
    Originator: YES

    I would think a flag would be the more friendly option; however, in this case adding a flag would require restructuring the style configurator. So, even if doing it the magic way would be restricting to the user in some cases, I think in this instance (in Notepad++) it'll produce the desired effects 99% of the time.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks