The problem here is that LFUN_BREAK_PARAGRAPH does not always send the
structureChanged() signal. As a result, the TocModel gets out of sync
with the document structure.
If, say, you backspace and merge two paragraphs, the signal is emitted by
void updateLabels(Buffer const & buf, bool childonly)
in buffer_funcs.cpp. But this is not usually called on
LFUN_BREAK_PARAGRAPH, because that instead calls
void updateLabels(Buffer const & buf, ParIterator & from,
ParIterator & to, bool childonly)
with arguments that seem to check only the labels in the surrounding
paragraphs and, if one of them needs to be changed, then, and only then,
will updateLabels() get called. But obviously the buffer structure HAS
changed in this case, and the question is then whether (a) we should
just call the second version of updateLabels(), or whether we should
just emit the structureChanged() signal directly. If so, then perhaps
the first version of updateLabels() should return a boolean, indicating
whether the other version of updateLabels() was called, in which case
the signal would already have been emitted.
I'm happy to implement whichever solution seems appropriate. Viz, in
Text.cpp, around line 649, either to do this:
- updateLabels(cur.buffer(), current_it, last_it);
+ updateLabels(cur.buffer());
or this:
+ cur.buffer().structureChanged()
possibly with the mentioned change to the return value of
updateLabels(). That should do it.
Richard
--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto