Neil Hodgson wrote:
> This problem appears to be sensitive to font choice and environment
> (OS and device driver versions). There appears to be a limit to the
> amount of text that can be drawn in one call and this limit may be in
> pixels or in characters. Changing styles occasionally will cause
> Scintilla to write more blocks and could avoid this. You could write a
> lexer, reuse an existing lexer that sees some meaning in your data
> (try the language menu), or write a Lua script that switches styles
> occasionally.
>
> It is likely this can be fixed by breaking the text up into smaller
> sections. This would add complexity to the code and added complexity
> means more bugs. Breaking should be sensitive to multi-byte characters
> and multi-character clusters: the underlying graphics engine
> understands these and so draws complex scripts, combining accents, and
> ligatures correctly.
Argh, I keep forgetting that the problem occurs only with long runs of
same style. Which happens often in this kind of file: untyped file, very
long strings (SVG path data), etc.
I am dreamming of an extended XML lexer (or perhaps a specific SVG one)
able to parse CSS, path strings, etc.
As you write, we could code a dummy lexer that only change style every n
characters, to apply on this kind of file.
Steven Cummings wrote:
I'll see if I can make some time soon to learn Lua. I didn't expect an
immediate fix for such a sporatic and strange problem, I just wanted to
make the case known. Anyway, I still need to toy with the style settings
and see what happens. I'll report back if I can figure anything concrete
out. Thanks!
Experimented a bit:
function StyleLine()
local H = function (h) return tonumber(h, 16) end
local style1, style2 = 1, 2
local STYLE_LENGTH = 10
local lineStartPos, lineEndPos = GetLineData(-1)
editor:StartStyling(lineStartPos, 31)
for i = 0, (lineEndPos - lineStartPos) / STYLE_LENGTH do
editor:SetStyling(STYLE_LENGTH,
math.mod(i, 2) == 0 and style1 or style2)
end
editor.StyleFore[style1] = H'112288'
editor.StyleFore[style2] = H'44AA66'
editor.StyleBack[style1] = H'AAFF88'
editor.StyleBack[style2] = H'AA88FF'
end
function GetLineData(lineNb)
if lineNb < 0 then
lineNb = editor:LineFromPosition(editor.CurrentPos)
end
local lineStartPos = editor:PositionFromLine(lineNb)
local lineEndPos = editor.LineEndPosition[lineNb]
return lineStartPos, lineEndPos, lineNb
end
However, when I run this script, I see colors flash briefly, then go
back to black. Note that style is here, since the line is now visible.
And indeed, Scintilla is much more reactive, I can move the caret much
faster.
If I run the script a second time, I can see the colors, although only
the fore ones. Strangely, I have to zoom in or out (using Ctrl+mouse
wheel or Ctrl+NumPad Plus or Minus) to see them at some font sizes...
I must admit I don't understand what is going on, here.
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest