Discussion:
Using SCI_ANNOTATIONCLEARALL can cause removal of lines !!!
(too old to reply)
John Vella
2012-04-25 21:25:11 UTC
Permalink
I've either found a bug or I'm doing something wrong (entirely
possible/likely). When adding an annotation to a line, then showing the
fold margin (which was initially set with a width of zero), the call to
SCI_ANNOTATIONCLEARALL actually causes the line that had the annotation to
be removed from the window. So for example, if I have in a plain text file
(no lexer assigned) these lines:

line1
line2
line3

then do the following sequence

SCI_ANNOTATIONSETTEXT 1 hello
SCI_ANNOTATIONSETVISIBLE ANNOTATION_BOXED <<< the text "hello" appears
below the second line
SCI_SETMARGINWIDTHN 2 10 <<< the fold margin appears, but
"hello" is now gone
SCI_ANNOTATIONCLEARALL

I notice that immediately after showing the fold margin that the annotation
text on the second line is cleared. Then the call to "clearall" causes the
second line to disappear!!

Am I missing a step when I display the previously hidden fold margin to
ensure that lines with annotations keep the annotation text?

Thanks,
-John
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To view this discussion on the web visit https://groups.google.com/d/msg/scintilla-interest/-/Y-JMQCL7358J.
To post to this group, send email to scintilla-***@googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
Neil Hodgson
2012-04-25 23:04:05 UTC
Permalink
John Vella:
 
I've either found a bug or I'm doing something wrong (entirely possible/likely). When adding an annotation to a line, then showing the fold margin (which was initially set with a width of zero), the call to SCI_ANNOTATIONCLEARALL actually causes the line that had the annotation to be removed from the window.
 
   Can't reproduce this with this script in SciTE on Windows

function showAnnotations()
scite.SendEditor(SCI_ANNOTATIONSETTEXT, 1, "hello")
        scite.SendEditor(SCI_ANNOTATIONSETVISIBLE, 2, 0)
        scite.SendEditor(SCI_SETMARGINWIDTHN, 2, 10)
        scite.SendEditor(SCI_ANNOTATIONCLEARALL, 0, 0)
end

   Tried both with margin initially visible and invisible and with wrap both on and off. Errors with disappearing lines are much more likely with wrap turned on as this interacts more with the line height / visibility code.

   Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-***@googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
John Vella
2012-04-25 23:15:35 UTC
Permalink
Have you built in some way to dump the document structure? Also, all I've
ever done with SciTE is to run to view various types of files. Is there a
way I could test things on Linux like you did on Windows (keep in mind I've
never driven SciTE via a script)?

Also, what version did you try? I'm using 3.03

And for me, I don't use line wrapping (ie it's off).

-John
Post by John Vella
I've either found a bug or I'm doing something wrong (entirely
possible/likely). When adding an annotation to a line, then showing the
fold margin (which was initially set with a width of zero), the call to
SCI_ANNOTATIONCLEARALL actually causes the line that had the annotation to
be removed from the window.
Can't reproduce this with this script in SciTE on Windows
function showAnnotations()
scite.SendEditor(SCI_ANNOTATIONSETTEXT, 1, "hello")
scite.SendEditor(SCI_ANNOTATIONSETVISIBLE, 2, 0)
scite.SendEditor(SCI_SETMARGINWIDTHN, 2, 10)
scite.SendEditor(SCI_ANNOTATIONCLEARALL, 0, 0)
end
Tried both with margin initially visible and invisible and with wrap
both on and off. Errors with disappearing lines are much more likely with
wrap turned on as this interacts more with the line height / visibility
code.
Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To view this discussion on the web visit https://groups.google.com/d/msg/scintilla-interest/-/mjkgDDQDWs0J.
To post to this group, send email to scintilla-***@googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
Neil Hodgson
2012-04-25 23:42:06 UTC
Permalink
Post by John Vella
Have you built in some way to dump the document structure?
No.
Post by John Vella
Also, all I've ever done with SciTE is to run to view various types of files. Is there a way I could test things on Linux like you did on Windows (keep in mind I've never driven SciTE via a script)?
Scripts work on Linux as well.
Post by John Vella
Also, what version did you try? I'm using 3.03
The current release 3.1.0.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-***@googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
John Vella
2012-04-26 00:31:09 UTC
Permalink
Since I've never done any scripting, do you have any pointers to how I
could get started? I've been trying to glean how to do this using Lua but
it's not quite the "hold my hand" cookbook that I was hoping for. This is
the site I was looking at: http://lua-users.org/wiki/UsingLuaWithScite

Thanks in advance,

-John
Post by John Vella
Post by John Vella
Have you built in some way to dump the document structure?
No.
Post by John Vella
Also, all I've ever done with SciTE is to run to view various types of
files. Is there a way I could test things on Linux like you did on Windows
(keep in mind I've never driven SciTE via a script)?
Scripts work on Linux as well.
Post by John Vella
Also, what version did you try? I'm using 3.03
The current release 3.1.0.
Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To view this discussion on the web visit https://groups.google.com/d/msg/scintilla-interest/-/8FBe3q-tcfMJ.
To post to this group, send email to scintilla-***@googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
John Vella
2012-04-26 16:35:51 UTC
Permalink
Ok, through some due-diligence on my part I've been able to recreate the
problem in SciTE using some Lua scripting. The key I think is to separate
the operations in the script so that the window is forced to do a redraw
between steps(dunno, just a hunch). Here's what I put into the
SciTEStartup.lua file:

function run_first()
scite.SendEditor(SCI_ANNOTATIONSETTEXT, 0, "LINE1")
scite.SendEditor(SCI_ANNOTATIONSETVISIBLE, 2, 0)
end
function run_second()
scite.SendEditor(SCI_ANNOTATIONCLEARALL, 0, 0)
end

I then put the following into the SciTE.properties file:

command.name.12.*=Run First
command.12.*=run_first
command.subsystem.12.*=3
command.mode.12.*=savebefore:no
command.shortcut.12.*=F9

command.name.13.*=Run Second
command.13.*=run_second
command.subsystem.13.*=3
command.mode.13.*=savebefore:no
command.shortcut.13.*=F10

I then started SciTE and opened a file with these lines in it:

line1
line2
line3

And then all I did was hit F9 and then F10. When I was done the second line
had disappeared!!

I tried this with both 3.03 as well as the latest 3.1. I hope this is
enough information to allow you to recreate the problem.

-John
Post by John Vella
Since I've never done any scripting, do you have any pointers to how I
could get started? I've been trying to glean how to do this using Lua but
it's not quite the "hold my hand" cookbook that I was hoping for. This is
the site I was looking at: http://lua-users.org/wiki/UsingLuaWithScite
Thanks in advance,
-John
Post by John Vella
Post by John Vella
Have you built in some way to dump the document structure?
No.
Post by John Vella
Also, all I've ever done with SciTE is to run to view various types of
files. Is there a way I could test things on Linux like you did on Windows
(keep in mind I've never driven SciTE via a script)?
Scripts work on Linux as well.
Post by John Vella
Also, what version did you try? I'm using 3.03
The current release 3.1.0.
Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To view this discussion on the web visit https://groups.google.com/d/msg/scintilla-interest/-/KWep6gWjGagJ.
To post to this group, send email to scintilla-***@googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
Neil Hodgson
2012-04-27 00:55:20 UTC
Permalink
Ok, through some due-diligence on my part I've been able to recreate the problem in SciTE using some Lua scripting. The key I think is to separate the operations in the script so that the window is forced to do a redraw between steps(dunno, just a hunch).
Sounds like a reasonable conjecture.
line1
line2
line3
And then all I did was hit F9 and then F10. When I was done the second line had disappeared!!
I understand this to mean that the text 'line2' is no longer present for you, not that the boxed 'hello' has disappeared.

What I see on both Windows and Linux is that [hello] appears after Run First and then goes away after Run Second. I downloaded version 3.0.3 and rebuilt in case there is some versioning issue and also removed all settings from user properties but everything works fine. This is on a fairly unchanged 32-bit Xubuntu 11.10 using GTK+ 3.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-***@googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
John Vella
2012-04-27 01:21:02 UTC
Permalink
Just so I'm clear, are you saying you still can't reproduce the problem? And yes, the problem is that the document text is removed as well as the annotation text. This becomes really clear when line numbers are shown because you can see the numbers goes from "1" to "3".

-John

Sent from my iPad
Ok, through some due-diligence on my part I've been able to recreate the problem in SciTE using some Lua scripting. The key I think is to separate the operations in the script so that the window is forced to do a redraw between steps(dunno, just a hunch).
Sounds like a reasonable conjecture.
line1
line2
line3
And then all I did was hit F9 and then F10. When I was done the second line had disappeared!!
I understand this to mean that the text 'line2' is no longer present for you, not that the boxed 'hello' has disappeared.

What I see on both Windows and Linux is that [hello] appears after Run First and then goes away after Run Second. I downloaded version 3.0.3 and rebuilt in case there is some versioning issue and also removed all settings from user properties but everything works fine. This is on a fairly unchanged 32-bit Xubuntu 11.10 using GTK+ 3.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-***@googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-***@googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
Neil Hodgson
2012-04-27 01:27:09 UTC
Permalink
Post by John Vella
Just so I'm clear, are you saying you still can't reproduce the problem?
Yes. I can not reproduce the problem.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-***@googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
Philippe Paternotte
2014-08-04 14:21:46 UTC
Permalink
Post by Neil Hodgson
Post by John Vella
Just so I'm clear, are you saying you still can't reproduce the problem?
Yes. I can not reproduce the problem.
Neil
Hi,
I have a problem that seems to be related.
Platform is Windows XP SP3, I work with a single editor / multiple documents.
When doing this sequence of actions:
- Create & load a 1st document, assign it to the editor.
- Create & load a 2nd document, assign it to the editor.
- Add some annotations with a standard simple style and activate annotations display (say: ANNOTATIONS_BOXED): they are displayed as expected.
- Switch to the 1st document: OK.
- Switch back to the 2nd document: The annotations are not displayed, their lines only display the document's text.
Then:
If I read the annotations back (SCI_ANNOTATIONGETTEXT) they are present.
If I send an annotation show again (ANNOTATION_BOXED), nothing is changed.
Better: if now I send an annotation hide (ANNOTATION_HIDDEN), all lines where there are annotations disapear!
Then:
If I add a new annotation on another line, it is correctly displayed but the stealth ones stay stealth.
If I replace the annotation on one that is stealth, nothing changes.

This behavior seems to be related to document switching.

I've tried a lot of tests, read a lot of other threads here and elsewhere and didn't find any information, only the present thread that was ending by a "sorry I cannot reproduce"...

Please help.

Philippe.
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Philippe Paternotte
2014-08-04 15:08:26 UTC
Permalink
New info:
I had a new idea and traced the way a document switch is made in the package I use (I didn't say all in my previous message, sorry the given sequence alone works indeed, it's somewhere else).

In the package, when switching to a document, a SCI_CLEARDOCUMENTSTYLE is sent before restoring all styles according to the lexer to use and the saved context.

When I removed that SCI_CLEARDOCUMENTSTYLE call all went OK.

The Scintilla documentation says SCI_CLEARDOCUMENTSTYLE clears styles and folding states but nothing about any impact to annotations.

For now I've removed the SCI_CLEARDOCUMENTSTYLE as it seems to be not required as the styles are restored anyway.

Now my package works but I think there's a bug in Scintilla...

Best regards,

Philippe.
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Neil Hodgson
2014-08-04 22:26:30 UTC
Permalink
Post by Philippe Paternotte
In the package, when switching to a document, a SCI_CLEARDOCUMENTSTYLE is sent before restoring all styles according to the lexer to use and the saved context.
When I removed that SCI_CLEARDOCUMENTSTYLE call all went OK.
OK. Can you try adding this line in Editor::ClearDocumentStyle after cs.ShowAll();:

SetAnnotationHeights(0, pdoc->LinesTotal());

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Philippe Paternotte
2014-08-04 22:37:07 UTC
Permalink
Hi Neil,
Sorry I do not understand exactly what you meant: I do not have the
Scintilla source / nor modify / compile it, I only use the dll.
Philippe.
Post by Philippe Paternotte
Post by Philippe Paternotte
In the package, when switching to a document, a SCI_CLEARDOCUMENTSTYLE
is sent before restoring all styles according to the lexer to use and the
saved context.
Post by Philippe Paternotte
When I removed that SCI_CLEARDOCUMENTSTYLE call all went OK.
SetAnnotationHeights(0, pdoc->LinesTotal());
Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Loading...