Annotations and line numbers

101 views
Skip to first unread message

Greg

unread,
Oct 23, 2012, 1:46:19 PM10/23/12
to scintilla...@googlegroups.com
I have been experimenting with annotations to display my compiler script code and it works very nicely. However, when I add and remove annotation I want to keep the same top line visible. It seems that with annotation on, line numbers now relate to lines including the annotation.

Am I missing something, or do I need to iterate through all the lines and ask each one how many annotation lines there are or Is there a better way?

For example when talking about folding there is SCI_VISIBLEFROMDOCLINE(int docLine), which copes with hidden lines.

I realise that I'm being lazy as I could "use the source"... but if someone out there already knows the answer... Otherwise I'll have a dig for it, however looking for something that might not be there is quite hard!

Neil Hodgson

unread,
Oct 24, 2012, 2:56:29 AM10/24/12
to scintilla...@googlegroups.com
Greg:

I have been experimenting with annotations to display my compiler script code and it works very nicely. However, when I add and remove annotation I want to keep the same top line visible. It seems that with annotation on, line numbers now relate to lines including the annotation.

Am I missing something, or do I need to iterate through all the lines and ask each one how many annotation lines there are or Is there a better way?

For example when talking about folding there is SCI_VISIBLEFROMDOCLINE(int docLine), which copes with hidden lines.

   Its likely SCI_VISIBLEFROMDOCLINE does what you want.

   Neil

Greg

unread,
Oct 26, 2012, 6:07:58 AM10/26/12
to scintilla...@googlegroups.com
Hi Neil,
Thanks for the information. Yes, SCI_VISIBLEFROMDOCLINE and SCI_DOCLINEFROMVISIBLE do exactly what is required.

Can I suggest that the doc be ammended so that both these routines say:

"when some lines are hidden and/or annotations are displayed..."

And that the Annotation section should document that you will likely need to use these two routines. Also, should the Set/Get first visible line explain that annotations add and hidden lines subtract? I suddenly realise that I am confused about how this works.

As ever, many thanks for your much appreciated work... I hope you enjoy your travelling. If you pass through Cambridge, England let me know and I'll buy you a beer.

Neil Hodgson

unread,
Oct 27, 2012, 8:52:00 AM10/27/12
to scintilla...@googlegroups.com
Greg:

> Can I suggest that the doc be ammended so that both these routines say:
>
> "when some lines are hidden and/or annotations are displayed..."

Maybe. I think that calling out all cases at the start could dilute the concept with less commonly used features. It may be better to add something after saying that annotations also affect visible <-> doc lines. Its also possible annotations are more widely used than I thought.

> And that the Annotation section should document that you will likely need to use these two routines.

Yes, although most code is interested in doc lines with no need to convert to or from display lines.

> Also, should the Set/Get first visible line explain that annotations add and hidden lines subtract? I suddenly realise that I am confused about how this works.

Write something that deconfuses you and I'm sure it can be helpful to others ;-)

Neil

Neil Hodgson

unread,
Jan 4, 2013, 8:03:55 AM1/4/13
to scintilla...@googlegroups.com
Greg:

> Can I suggest that the doc be ammended so that both these routines say:
>
> "when some lines are hidden and/or annotations are displayed..."

Added annotation into explanation about display line <-> doc line.

Neil

Reply all
Reply to author
Forward
0 new messages