First off, a big thanks to Lex Trotman and Frank Lanitz. I've now fixed the help, and settings problems in my plugin, and I think that I've figured out what the problem is when I try to implement remembering of fold states.
When I watch what happens in my ln_document_open function (which is called when the "document-open" callback is activated in the plugin on opening a file), as I iterate through the lines for some reason the SC_FOLDLEVELHEADERFLAG flag is not set for any lines including lines where there should be folds. I use scintilla_send_message(sci,SCI_GETFOLDLEVEL,iLineNumber,0) to get the fold level. For some reason, if there is a call to dialogs_show_msgbox in the document-open callback function, then SC_FOLDLEVELHEADERFLAG is set appropriately.
Is this a bug? Or does the editor not normally set fold flags until later, and the dialogs_show_msgbox simply forces scintilla to display (and so set fold flags) earlier than it normally would? If so, is there a function I can call that will do this without having to display a message box, or is there another way to activate my code after the fold flags have been calculated?
William Fraser
On Thu, 16 Dec 2010 22:04:31 +0000 WILLIAM FRASER william.fraser@virgin.net wrote:
[...] I use scintilla_send_message(sci,SCI_GETFOLDLEVEL,iLineNumber,0) to get the fold level. For some reason, if there is a call to dialogs_show_msgbox in the document-open callback function, then SC_FOLDLEVELHEADERFLAG is set appropriately.
Is this a bug? Or does the editor not normally set fold flags until later, and the dialogs_show_msgbox simply forces scintilla to display (and so set fold flags) earlier than it normally would? [...]
Can't answer your question, but from what I remember about SciTE, it only uses one scintilla component, and when you switch to another tab, it does the following (among the other things):
1. Cycles the current file lines and remembers any closed folds. 2. Switches the document. 3. Checks the remembered closed folds for the new document and closes them.
Or something like that, and there were no special function calls IIRC. Perhaps you should take a look at SciTE source.