On 14.8.2014 11:05, Phil Thompson wrote:
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

Hi Phil,

Just figured out that when calling SendScintilla with SCI_SETSTYLING, I used indexes that went out of the document scope.
That doesn't seem to raise an error on Windows, only on Linux.

As for the hotspot API, I think something like the indicators use would be the best and the most consistent. Scintilla uses only a single hotspot, so if adding multiple styles is not an option, scratch that idea.

Setting up a hotspot style:

   int        setHotspotForeColor(QColor color, int hotspotNumber)
   QColor hotspotForeColor(int hotspotNumber)
   int        sethotspotForeColorEnabled(bool useForegroundColor, int
   hotspotNumber)
   bool     hotspotForeColorEnabled(int hotspotNumber)

   int        setHotspotBackColor(bool useBackgroundColor, QColor
   color, int hotspotNumber)
   QColor hotspotBackColor(int hotspotNumber)
   int        sethotspotBackColorEnabled(bool useBackgroundColor, int
   hotspotNumber)
   bool     hotspotBackColorEnabled(int hotspotNumber)

   int        setHotspotUnderline(bool underline, int hotspotNumber)
   bool     hotspotUnderline(int hotspotNumber)

   int        setHotspotSingleLine(bool singleLine, int hotspotNumber)
   bool     hotspotSingleLine(int hotspotNumber)

Styling with a hotspot:

   fillHotspotRange(int lineFrom, int indexFrom, int lineTo, int
   indexTo, int hotspotNumber)
   clearHotspotRange(int lineFrom, int indexFrom, int lineTo, int
   indexTo, int hotspotNumber)


I hope I understood you correctly about the API proposal.

Matic
_______________________________________________
QScintilla mailing list
[email protected]
http://www.riverbankcomputing.com/mailman/listinfo/qscintilla

Reply via email to