[QScintilla] hotspot error on Linux

Phil Thompson phil at riverbankcomputing.com
Thu Aug 14 10:05:00 BST 2014


On 08/08/2014 11:25 pm, Matic Kukovec wrote:
> The last 5 lines of the function are at the same indentation level as
> the others,
> Thunderbird just messed up the indentation.
> Sorry.
> 
> On 9.8.2014 0:19, Matic Kukovec wrote:
>> Hi guys,
>> 
>> I have a PyQt4 application with a QScintilla2 editor with Python3 and 
>> the following function:
>>     def create_hotspot(node_tab):
>>             #Create the hotspot boundaries
>>             hotspot_line            = node_tab.lines()-2
>>             hotspot_first_ch     = 
>> node_tab.text(hotspot_line).index("-")
>>             hotspot_length       = node_tab.lineLength(hotspot_line)
>>             hotspot_start          = 
>> node_tab.positionFromLineIndex(hotspot_line, hotspot_first_ch)
>>             hotspot_end            = 
>> node_tab.positionFromLineIndex(hotspot_line, hotspot_length)
>>             #Style the hotspot
>> node_tab.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_STYLESETHOTSPOT, 
>> 2, True)
>> node_tab.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_SETHOTSPOTACTIVEFORE, 
>> True, 0xff0000)
>> node_tab.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_SETHOTSPOTACTIVEUNDERLINE, 
>> True)
>> node_tab.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_STARTSTYLING, 
>> hotspot_start, 31)
>> node_tab.SendScintilla(PyQt4.Qsci.QsciScintillaBase.SCI_SETSTYLING, 
>> hotspot_end, 2)    <- ERROR
>> 
>> 
>> On Windows this works great, but on Ubuntu this gives me the error at 
>> the last line with the message:
>> Assertion [lengthStyle == 0 || (lengthStyle > 0 && lengthStyle + 
>> position <= style.Length())]
>>  failed at ../src/CellBuffer.cpp 426

I'd need a short complete example that demonstrates the problem.

However a better solution would be to add a decent hotspot API so you 
wouldn't need to fiddle with things like this. Do you want to propose 
such an API?

Phil


More information about the QScintilla mailing list