#1520 LexCPP - wrong value returned by SCI_GETSTYLEFROMSUBSTYLE

Bug
closed-fixed
scintilla (313)
5
2013-10-15
2013-09-04
No

In LexCPP lexer SCI_GETSTYLEFROMSUBSTYLE command will not return proper base style value when you pass inactive substyle value to it.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2013-09-04

    Unsure what is meant by inactive here. It shouldn't make any difference whether any identifiers have been set. The result after freeing substyles should be to return the input value, the same as before the allocation. Thats what the first and last call to GetStyleFromSubStyle are checking in test/simpleTests.py:

    def testAllocate(self):
        self.ed.Lexer = self.ed.SCLEX_CPP
        self.assertEquals(self.ed.GetStyleFromSubStyle(0x80), 0x80)
        self.assertEquals(self.ed.GetSubStylesStart(self.ed.SCE_C_IDENTIFIER), 0)
        self.assertEquals(self.ed.GetSubStylesLength(self.ed.SCE_C_IDENTIFIER), 0)
        numSubStyles = 5
        subs = self.ed.AllocateSubStyles(self.ed.SCE_C_IDENTIFIER, numSubStyles)
        self.assertEquals(subs, 0x80)
        self.assertEquals(self.ed.GetSubStylesStart(self.ed.SCE_C_IDENTIFIER), 0x80)
        self.assertEquals(self.ed.GetSubStylesLength(self.ed.SCE_C_IDENTIFIER), numSubStyles)
        self.assertEquals(self.ed.GetStyleFromSubStyle(subs), self.ed.SCE_C_IDENTIFIER)
        self.assertEquals(self.ed.GetStyleFromSubStyle(subs+numSubStyles-1), self.ed.SCE_C_IDENTIFIER)
        self.assertEquals(self.ed.GetStyleFromSubStyle(self.ed.SCE_C_IDENTIFIER), self.ed.SCE_C_IDENTIFIER)
        # Now free and check same as start
        self.ed.FreeSubStyles()
        self.assertEquals(self.ed.GetStyleFromSubStyle(subs), subs)
        self.assertEquals(self.ed.GetSubStylesStart(self.ed.SCE_C_IDENTIFIER), 0)
        self.assertEquals(self.ed.GetSubStylesLength(self.ed.SCE_C_IDENTIFIER), 0)
    
     
  • Marko Njezic

    Marko Njezic - 2013-09-04

    By inactive substyle I was referring to the substyle value that's part of secondary styles used by LexCPP inside inactive preprocessor blocks.

     
  • Marko Njezic

    Marko Njezic - 2013-09-04

    For example, if you attach a substyle to the C++ identifiers (style 11), you'll end up with two substyles with values 128 (primary style) and 192 (secondary style used for inactive blocks).

    Calling SCI_GETSTYLEFROMSUBSTYLE(128) will return 11, while SCI_GETSTYLEFROMSUBSTYLE(192) will wrongly return 192, instead of 75.

     
  • Neil Hodgson

    Neil Hodgson - 2013-09-05
    • labels: --> scintilla
    • status: open --> open-fixed
    • assigned_to: Neil Hodgson
     
  • Neil Hodgson

    Neil Hodgson - 2013-10-15
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks