Fixed InsetText::getLyXText().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3303 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2002-01-07 14:50:57 +00:00
parent c99b2f4819
commit a237be918f
2 changed files with 35 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2002-01-07 Juergen Vigna <jug@sad.it>
* insettext.C (getLyXText): Fixed this function. An insert into the
map is only done if we REALLY have a new BufferView.
2002-01-07 Martin Vermeer <martin.vermeer@hut.fi>
* insettext.C: fix bug illustrated by attachment #37 of bug #59

View File

@ -2128,26 +2128,41 @@ LyXText * InsetText::getLyXText(BufferView const * lbv,
Cache::iterator it = cache.find(bv);
if (it != cache.end()) {
if (do_reinit)
if (do_reinit) {
reinitLyXText();
else if (do_resize)
} else if (do_resize) {
resizeLyXText(do_resize);
if (lt || !it->second.remove) {
lyx::Assert(it->second.text.get());
cached_text = it->second.text;
if (recursive && the_locking_inset) {
return the_locking_inset->getLyXText(bv, true);
}
return cached_text.get();
} else if (it->second.remove) {
if (locked) {
saveLyXTextState(it->second.text.get());
} else {
sstate.lpar = 0;
} else {
if (lt || !it->second.remove) {
lyx::Assert(it->second.text.get());
cached_text = it->second.text;
if (recursive && the_locking_inset) {
return the_locking_inset->getLyXText(bv, true);
}
return cached_text.get();
} else if (it->second.remove) {
if (locked) {
saveLyXTextState(it->second.text.get());
} else {
sstate.lpar = 0;
}
}
//
// when we have to reinit the existing LyXText!
//
it->second.text->init(bv);
restoreLyXTextState(bv, it->second.text.get());
it->second.remove = false;
}
cached_text = it->second.text;
if (the_locking_inset && recursive) {
return the_locking_inset->getLyXText(bv);
}
return cached_text.get();
}
///
// we are here only if we don't have a BufferView * in the cache!!!
///
cached_text.reset(new LyXText(const_cast<InsetText *>(this)));
cached_text->init(bv);
restoreLyXTextState(bv, cached_text.get());