[QScintilla] hotspot error on Linux
Matic Kukovec
matic.kukovec at pametnidom.si
Sat Sep 6 17:58:22 BST 2014
On 3.9.2014 17:19, Phil Thompson wrote:
> On 25/08/2014 10:50 am, Matic Kukovec wrote:
>> 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)
>
> I've added setHotspotForegroundColor(), resetHotspotForegroundColor(),
> setHotspotBackgroundColor() and resetHotspotBackgroundColor() which
> are similar to how the selection foreground and background are handled.
>
> I've also added setHotspotUnderline() and setHotspotWrap(). Note that
> these are all global - Scintilla doesn't support different values for
> different styles.
>
>> 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)
>
> Hotspots are implemented as styles and the normal way to apply a style
> is via a lexer. If you use calls like the above and you have a lexer
> installed then they are going to fight about what the style of
> individual characters should be. If you don't have a lexer installed
> than you can write a QsciLexerCustom sub-class that will apply a
> QsciStyle with hotspot enabled wherever you want. Using the custom
> lexer also has the advantage that Scintilla decides what needs styling
> and when according to how the user is moving around and updating the
> document.
>
> Given that, do you still need something like fillHotspotRange()?
>
> Phil
That is brilliant Phil, thanks!
Using styles to set the hotspot is already good enough, no need for
fillHotspotRange/clearHotspotRange.
Will try it out.
Also, is there an efficient way of opening large binary files (up to
1Gb) without any styling?
Example:
binary_text = open(file,'rb').read()
decoded_text = binary.decode("utf-8", errors="replace")
scintilla.setLexer(None)
scintilla.setText(decoded_text)
I tried opening a 600MB file with the above example and the setText
method spikes RAM usage
to around 5GB and then returns to a normal 1.8GB.
Is there a more efficient way of reading large files, maybe in chunks or
something similar?
Matic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/qscintilla/attachments/20140906/c516a9cb/attachment.html>
More information about the QScintilla
mailing list