I want to set the annotation text's style of the second line but it does not work.
Please, correct my script:
scite.SendEditor(SCI_ANNOTATIONSETTEXT, 68, 'aaaa\nbbbbb\ncccccc')
scite.SendEditor(SCI_ANNOTATIONSETSTYLES, 3, "fore:#FFFF00,back:#FF0000")
scite.SendEditor(SCI_ANNOTATIONSETSTYLE, 2, 3)
scite.SendEditor(SCI_ANNOTATIONSETVISIBLE, 2)
--
mozers
<http://scite.net.ru>
> I want to set the annotation text's style of the second line but it does not work.
> Please, correct my script:
>
> scite.SendEditor(SCI_ANNOTATIONSETTEXT, 68, 'aaaa\nbbbbb\ncccccc')
> scite.SendEditor(SCI_ANNOTATIONSETSTYLES, 3, "fore:#FFFF00,back:#FF0000")
You can't send property strings - use an array of style bytes like
in SetStylingEx. You also need to use the same line number in your
calls.
> scite.SendEditor(SCI_ANNOTATIONSETSTYLE, 2, 3)
> scite.SendEditor(SCI_ANNOTATIONSETVISIBLE, 2)
Neil
Neil
>> scite.SendEditor(SCI_ANNOTATIONSETSTYLES, 3, "fore:#FFFF00,back:#FF0000")
> You can't send property strings - use an array of style bytes like
> in SetStylingEx. You also need to use the same line number in your
> calls.
> There is also bug #2789430 in 1.78 that is fixed in CVS that means
> that SCI_ANNOTATIONSETSTYLE doesn't work with multi-line annotations.
Thanks for advice.
I compiled last version from CVS.
Now this script shows the annotation (all lines) in the set style (used style 12 lua):
--------------------------------------------
annotation_line = 5
annotation_text = 'line one\nline two\nline three'
annotation_style = 12
scite.SendEditor(SCI_ANNOTATIONSETTEXT, annotation_line, annotation_text)
scite.SendEditor(SCI_ANNOTATIONSETSTYLE, annotation_line, annotation_style)
scite.SendEditor(SCI_ANNOTATIONSETVISIBLE, ANNOTATION_BOXED)
--------------------------------------------
What is the way to show the second line of the annotation in the other style (e.g. 3) I do not understand :(
--
mozers
> What is the way to show the second line of the annotation in the other style (e.g. 3) I do not understand :(
If there are multiple styles within one annotation then set every
style byte with SCI_ANNOTATIONSETSTYLES:
scite.SendEditor(SCI_ANNOTATIONSETTEXT, annotation_line, "ab\ncd")
scite.SendEditor(SCI_ANNOTATIONSETSTYLES, annotation_line,
"\001\001\001\002\002")
Neil
> If there are multiple styles within one annotation then set every
> style byte with SCI_ANNOTATIONSETSTYLES:
> scite.SendEditor(SCI_ANNOTATIONSETTEXT, annotation_line, "ab\ncd")
> scite.SendEditor(SCI_ANNOTATIONSETSTYLES, annotation_line,
> "\001\001\001\002\002")
Thank you very much.
Everything works fine.
---------------------------------------------------------------------------
local function SetAnnotation (text, line)
local str = ''
local style = ''
for i = 1, #text, 2 do
str = str..text[i]
style = style..string.char(text[i+1]):rep(#text[i])
end
scite.SendEditor(SCI_ANNOTATIONSETTEXT, line, str)
scite.SendEditor(SCI_ANNOTATIONSETSTYLES, line, style)
scite.SendEditor(SCI_ANNOTATIONSETVISIBLE, ANNOTATION_BOXED)
end
local annot_line = 5
local annot_text = { -- text_line, style_line
'annotation line one\n', 4,
'annotation line two\n', 3,
'annotation line three', 12
}
SetAnnotation (annot_text, annot_line)
---------------------------------------------------------------------------
--
mozers