mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Applied Edwins patch, fixes to free memory read in insettext, partial fix
for the width of collapsable insets (more to do). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2444 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
30705f0927
commit
3c32875ece
@ -1,3 +1,7 @@
|
||||
2001-08-07 Edwin Leuven <leuven@fee.uva.nl>
|
||||
|
||||
* ControlSpellchecker.C: check next word after insert in personal dict
|
||||
|
||||
2001-08-06 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* ControlERT.[Ch]: new file
|
||||
|
@ -157,6 +157,7 @@ void ControlSpellchecker::replaceAll(string const & replacement)
|
||||
void ControlSpellchecker::insert()
|
||||
{
|
||||
speller_->insert(word_);
|
||||
check();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,16 @@
|
||||
2001-08-07 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* inset.C (getMaxWidth): recoded and all it's implementations!
|
||||
|
||||
* insettext.C (init,setParagraph+constructors): cleanups
|
||||
(reinitLyXText): fixed problem with wrong cursor when all paragraphs
|
||||
are new and I want do a save/restore of the cursor position which is
|
||||
not possible anymore.
|
||||
|
||||
* insetcollapsable.C (searchBackward): recollapse inset if not found.
|
||||
(searchBackward): ditto
|
||||
(selectNextWord): ditto
|
||||
|
||||
2001-08-07 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* insetlatexaccent.C (checkContents): Add some debug messages
|
||||
|
@ -34,14 +34,14 @@ using std::endl;
|
||||
unsigned int Inset::inset_id = 0;
|
||||
|
||||
Inset::Inset()
|
||||
: top_x(0), top_baseline(0), scx(0), id_(inset_id++), owner_(0),
|
||||
background_color_(LColor::inherit)
|
||||
: top_x(0), topx_set(false), top_baseline(0), scx(0),
|
||||
id_(inset_id++), owner_(0), background_color_(LColor::inherit)
|
||||
{}
|
||||
|
||||
|
||||
Inset::Inset(Inset const & in, bool same_id)
|
||||
: top_x(0), top_baseline(0), scx(0), owner_(0), name_(in.name_),
|
||||
background_color_(in.background_color_)
|
||||
: top_x(0), topx_set(false), top_baseline(0), scx(0), owner_(0),
|
||||
name_(in.name_), background_color_(in.background_color_)
|
||||
{
|
||||
if (same_id)
|
||||
id_ = in.id();
|
||||
@ -310,10 +310,34 @@ UpdatableInset::localDispatch(BufferView * bv,
|
||||
|
||||
int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
|
||||
{
|
||||
if (owner())
|
||||
return static_cast<UpdatableInset*>
|
||||
int w;
|
||||
if (owner()){
|
||||
w = static_cast<UpdatableInset*>
|
||||
(owner())->getMaxWidth(bv, this);
|
||||
return bv->workWidth();
|
||||
} else {
|
||||
w = bv->workWidth();
|
||||
}
|
||||
if (w < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (owner()) {
|
||||
if (topx_set) // this makes only sense if we have a top_x
|
||||
w = w - top_x + owner()->x();
|
||||
return w;
|
||||
}
|
||||
// check for margins left/right and extra right margin "const 5"
|
||||
if ((w - ((2 * TEXT_TO_INSET_OFFSET) + 5)) >= 0)
|
||||
w -= (2 * TEXT_TO_INSET_OFFSET) + 5;
|
||||
if (topx_set) {
|
||||
if ((w - top_x) < 10) {
|
||||
w = 10; // minimum I require!!!
|
||||
} else {
|
||||
w -= top_x;
|
||||
}
|
||||
} else if (w < 10) {
|
||||
w = 10;
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
|
||||
|
@ -278,7 +278,7 @@ public:
|
||||
/// open the inset
|
||||
virtual void open(BufferView *) {}
|
||||
/// close the inset
|
||||
virtual void close(BufferView *) {}
|
||||
virtual void close(BufferView *) const {}
|
||||
/// check if the font of the char we want inserting is correct
|
||||
/// and modify it if it is not.
|
||||
virtual bool checkInsertChar(LyXFont &);
|
||||
@ -289,6 +289,8 @@ protected:
|
||||
///
|
||||
mutable int top_x;
|
||||
///
|
||||
mutable bool topx_set; /* have we already drawn ourself! */
|
||||
///
|
||||
mutable int top_baseline;
|
||||
///
|
||||
mutable int scx;
|
||||
|
@ -217,6 +217,7 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
||||
}
|
||||
|
||||
top_x = int(x);
|
||||
topx_set = true;
|
||||
top_baseline = baseline;
|
||||
|
||||
int const bl = baseline - ascent(bv, f) + ascent_collapsed();
|
||||
@ -253,6 +254,7 @@ void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
|
||||
inset.edit(bv, xp, yy, button);
|
||||
}
|
||||
}
|
||||
first_after_edit = true;
|
||||
}
|
||||
|
||||
|
||||
@ -272,6 +274,7 @@ void InsetCollapsable::edit(BufferView * bv, bool front)
|
||||
return;
|
||||
inset.edit(bv, front);
|
||||
}
|
||||
first_after_edit = true;
|
||||
}
|
||||
|
||||
|
||||
@ -374,6 +377,7 @@ int InsetCollapsable::latex(Buffer const * buf, ostream & os,
|
||||
int InsetCollapsable::getMaxWidth(BufferView * bv,
|
||||
UpdatableInset const * inset) const
|
||||
{
|
||||
#if 0
|
||||
int const w = UpdatableInset::getMaxWidth(bv, inset);
|
||||
|
||||
if (w < 0) {
|
||||
@ -383,14 +387,21 @@ int InsetCollapsable::getMaxWidth(BufferView * bv,
|
||||
}
|
||||
// should be at least 30 pixels !!!
|
||||
return max(30, w - width_collapsed());
|
||||
#else
|
||||
return UpdatableInset::getMaxWidth(bv, inset);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
|
||||
bool reinit)
|
||||
{
|
||||
if (in_update)
|
||||
if (in_update) {
|
||||
if (reinit && owner()) {
|
||||
owner()->update(bv, font, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
in_update = true;
|
||||
inset.update(bv, font, reinit);
|
||||
if (reinit && owner()) {
|
||||
@ -407,6 +418,7 @@ InsetCollapsable::localDispatch(BufferView * bv, kb_action action,
|
||||
UpdatableInset::RESULT result = inset.localDispatch(bv, action, arg);
|
||||
if (result == FINISHED)
|
||||
bv->unlockInset(this);
|
||||
first_after_edit = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -584,17 +596,47 @@ void InsetCollapsable::open(BufferView * bv)
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::close(BufferView * bv)
|
||||
void InsetCollapsable::close(BufferView * bv) const
|
||||
{
|
||||
if (collapsed_)
|
||||
return;
|
||||
|
||||
collapsed_ = true;
|
||||
bv->updateInset(this, true);
|
||||
bv->updateInset(const_cast<InsetCollapsable *>(this), true);
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::setLabel(string const & l)
|
||||
void InsetCollapsable::setLabel(string const & l) const
|
||||
{
|
||||
label = l;
|
||||
}
|
||||
|
||||
|
||||
bool InsetCollapsable::searchForward(BufferView * bv, string const & str,
|
||||
bool const & cs, bool const & mw)
|
||||
{
|
||||
bool found = inset.searchForward(bv, str, cs, mw);
|
||||
if (first_after_edit && !found)
|
||||
close(bv);
|
||||
first_after_edit = false;
|
||||
return found;
|
||||
}
|
||||
bool InsetCollapsable::searchBackward(BufferView * bv, string const & str,
|
||||
bool const & cs, bool const & mw)
|
||||
{
|
||||
bool found = inset.searchBackward(bv, str, cs, mw);
|
||||
if (first_after_edit && !found)
|
||||
close(bv);
|
||||
first_after_edit = false;
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
string const InsetCollapsable::selectNextWord(BufferView * bv, float & value) const
|
||||
{
|
||||
string str = inset.selectNextWord(bv, value);
|
||||
if (first_after_edit && str.empty())
|
||||
close(bv);
|
||||
first_after_edit = false;
|
||||
return str;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public:
|
||||
void setFont(BufferView *, LyXFont const &, bool toggleall = false,
|
||||
bool selectall = false);
|
||||
///
|
||||
void setLabel(string const & l);
|
||||
void setLabel(string const & l) const;
|
||||
///
|
||||
void setLabelFont(LyXFont & f) { labelfont = f; }
|
||||
#if 0
|
||||
@ -171,11 +171,10 @@ public:
|
||||
///
|
||||
void open(BufferView *);
|
||||
///
|
||||
void close(BufferView *);
|
||||
void close(BufferView *) const;
|
||||
///
|
||||
string const selectNextWord(BufferView * bv, float & value) const {
|
||||
return inset.selectNextWord(bv, value);
|
||||
}
|
||||
string const selectNextWord(BufferView * bv, float & value) const;
|
||||
|
||||
void selectSelectedWord(BufferView * bv) {
|
||||
inset.selectSelectedWord(bv);
|
||||
}
|
||||
@ -184,13 +183,9 @@ public:
|
||||
}
|
||||
///
|
||||
bool searchForward(BufferView * bv, string const & str,
|
||||
bool const & cs = true, bool const & mw = false) {
|
||||
return inset.searchForward(bv, str, cs, mw);
|
||||
}
|
||||
bool const & cs = true, bool const & mw = false);
|
||||
bool searchBackward(BufferView * bv, string const & str,
|
||||
bool const & cs = true, bool const & mw = false) {
|
||||
return inset.searchBackward(bv, str, cs, mw);
|
||||
}
|
||||
bool const & cs = true, bool const & mw = false);
|
||||
/// check if the font of the char we want inserting is correct
|
||||
/// and modify it if it is not.
|
||||
virtual bool checkInsertChar(LyXFont &) { return false; }
|
||||
@ -208,14 +203,14 @@ protected:
|
||||
int getMaxTextWidth(Painter & pain, UpdatableInset const *) const;
|
||||
|
||||
///
|
||||
bool collapsed_;
|
||||
mutable bool collapsed_;
|
||||
///
|
||||
LColor::color framecolor;
|
||||
///
|
||||
LyXFont labelfont;
|
||||
public:
|
||||
///
|
||||
InsetText inset;
|
||||
mutable InsetText inset;
|
||||
protected:
|
||||
///
|
||||
mutable int button_length;
|
||||
@ -230,7 +225,7 @@ protected:
|
||||
|
||||
private:
|
||||
///
|
||||
string label;
|
||||
mutable string label;
|
||||
#if 0
|
||||
///
|
||||
bool autocollapse;
|
||||
@ -239,6 +234,8 @@ private:
|
||||
mutable int oldWidth;
|
||||
///
|
||||
bool in_update;
|
||||
///
|
||||
mutable bool first_after_edit;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -342,7 +342,7 @@ string const InsetERT::get_new_label() const
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::setButtonLabel()
|
||||
void InsetERT::setButtonLabel() const
|
||||
{
|
||||
if (status_ == Collapsed) {
|
||||
setLabel(get_new_label());
|
||||
@ -423,6 +423,7 @@ void InsetERT::draw(BufferView * bv, LyXFont const & f,
|
||||
}
|
||||
|
||||
top_x = int(x);
|
||||
topx_set = true;
|
||||
top_baseline = baseline;
|
||||
|
||||
int const bl = baseline - ascent(bv, f) + ascent_collapsed();
|
||||
@ -449,7 +450,7 @@ void InsetERT::set_latex_font(BufferView * bv)
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::status(BufferView * bv, ERTStatus const st)
|
||||
void InsetERT::status(BufferView * bv, ERTStatus const st) const
|
||||
{
|
||||
if (st != status_) {
|
||||
status_ = st;
|
||||
@ -469,11 +470,11 @@ void InsetERT::status(BufferView * bv, ERTStatus const st)
|
||||
need_update = FULL;
|
||||
setButtonLabel();
|
||||
if (bv)
|
||||
bv->unlockInset(this);
|
||||
bv->unlockInset(const_cast<InsetERT *>(this));
|
||||
break;
|
||||
}
|
||||
if (bv)
|
||||
bv->updateInset(this, true);
|
||||
bv->updateInset(const_cast<InsetERT *>(this), true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -493,7 +494,7 @@ void InsetERT::open(BufferView * bv)
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::close(BufferView * bv)
|
||||
void InsetERT::close(BufferView * bv) const
|
||||
{
|
||||
if (collapsed_)
|
||||
return;
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
///
|
||||
void open(BufferView *);
|
||||
///
|
||||
void close(BufferView *);
|
||||
void close(BufferView *) const;
|
||||
///
|
||||
bool inlined() const { return status_ == Inlined; }
|
||||
///
|
||||
@ -107,7 +107,7 @@ public:
|
||||
///
|
||||
ERTStatus status() const { return status_; }
|
||||
///
|
||||
void status(BufferView *, ERTStatus const st);
|
||||
void status(BufferView *, ERTStatus const st) const;
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
|
||||
@ -117,12 +117,12 @@ private:
|
||||
///
|
||||
string const get_new_label() const;
|
||||
///
|
||||
void setButtonLabel();
|
||||
void setButtonLabel() const;
|
||||
///
|
||||
void set_latex_font(BufferView *);
|
||||
|
||||
///
|
||||
ERTStatus status_;
|
||||
mutable ERTStatus status_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -266,6 +266,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
||||
cleared = true;
|
||||
}
|
||||
top_x = int(x);
|
||||
topx_set = true;
|
||||
top_baseline = baseline;
|
||||
x += ADD_TO_TABULAR_WIDTH;
|
||||
if (cleared) {
|
||||
@ -459,8 +460,12 @@ void InsetTabular::drawCellSelection(Painter & pain, int x, int baseline,
|
||||
|
||||
void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit)
|
||||
{
|
||||
if (in_update)
|
||||
if (in_update) {
|
||||
if (reinit && owner()) {
|
||||
owner()->update(bv, font, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
in_update = true;
|
||||
if (reinit) {
|
||||
need_update = INIT;
|
||||
|
@ -117,49 +117,30 @@ InsetText::InnerCache::InnerCache(boost::shared_ptr<LyXText> t)
|
||||
|
||||
|
||||
InsetText::InsetText()
|
||||
: UpdatableInset(), lt(0), in_update(false)
|
||||
{
|
||||
par = new Paragraph;
|
||||
init();
|
||||
in_update = false;
|
||||
}
|
||||
|
||||
|
||||
InsetText::InsetText(InsetText const & ins, bool same_id)
|
||||
: UpdatableInset()
|
||||
InsetText::InsetText(InsetText const & in, bool same_id)
|
||||
: UpdatableInset(in, same_id), lt(0), in_update(false)
|
||||
{
|
||||
par = 0;
|
||||
init(&ins, same_id);
|
||||
in_update = false;
|
||||
autoBreakRows = ins.autoBreakRows;
|
||||
init(&in, same_id);
|
||||
}
|
||||
|
||||
|
||||
InsetText & InsetText::operator=(InsetText const & it)
|
||||
{
|
||||
init(&it);
|
||||
autoBreakRows = it.autoBreakRows;
|
||||
return * this;
|
||||
}
|
||||
|
||||
|
||||
void InsetText::init(InsetText const * ins, bool same_id)
|
||||
{
|
||||
top_y = 0;
|
||||
last_width = 0;
|
||||
last_height = 0;
|
||||
insetAscent = 0;
|
||||
insetDescent = 0;
|
||||
insetWidth = 0;
|
||||
the_locking_inset = 0;
|
||||
old_max_width = 0;
|
||||
no_selection = false;
|
||||
need_update = INIT;
|
||||
drawTextXOffset = 0;
|
||||
drawTextYOffset = 0;
|
||||
autoBreakRows = false;
|
||||
drawFrame_ = NEVER;
|
||||
xpos = 0.0;
|
||||
frame_color = LColor::insetframe;
|
||||
if (ins) {
|
||||
setParagraphData(ins->par);
|
||||
autoBreakRows = ins->autoBreakRows;
|
||||
@ -167,15 +148,35 @@ void InsetText::init(InsetText const * ins, bool same_id)
|
||||
frame_color = ins->frame_color;
|
||||
if (same_id)
|
||||
id_ = ins->id_;
|
||||
} else {
|
||||
Paragraph * p = par;
|
||||
while(p) {
|
||||
p->setInsetOwner(this);
|
||||
p = p->next();
|
||||
}
|
||||
par->setInsetOwner(this);
|
||||
the_locking_inset = 0;
|
||||
drawFrame_ = NEVER;
|
||||
frame_color = LColor::insetframe;
|
||||
autoBreakRows = false;
|
||||
}
|
||||
top_y = 0;
|
||||
last_width = 0;
|
||||
last_height = 0;
|
||||
insetAscent = 0;
|
||||
insetDescent = 0;
|
||||
insetWidth = 0;
|
||||
old_max_width = 0;
|
||||
no_selection = false;
|
||||
need_update = INIT;
|
||||
drawTextXOffset = 0;
|
||||
drawTextYOffset = 0;
|
||||
xpos = 0.0;
|
||||
locked = false;
|
||||
old_par = 0;
|
||||
last_drawn_width = -1;
|
||||
frame_is_visible = false;
|
||||
cached_bview = 0;
|
||||
sstate.lpar = 0;
|
||||
lt = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -201,7 +202,7 @@ void InsetText::clear()
|
||||
par = tmp;
|
||||
}
|
||||
par = new Paragraph;
|
||||
reinitLyXText();
|
||||
reinitLyXText(true);
|
||||
}
|
||||
|
||||
|
||||
@ -342,6 +343,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
need_update = INIT;
|
||||
old_max_width = nw;
|
||||
bv->text->status(bv, LyXText::CHANGED_IN_DRAW);
|
||||
topx_set = true;
|
||||
return;
|
||||
} else {
|
||||
top_x = old_x;
|
||||
@ -358,6 +360,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
// no draw is necessary !!!
|
||||
if ((drawFrame_ == LOCKED) && !locked && !par->size()) {
|
||||
top_x = int(x);
|
||||
topx_set = true;
|
||||
top_baseline = baseline;
|
||||
x += width(bv, f);
|
||||
if (need_update & CLEAR_FRAME)
|
||||
@ -370,7 +373,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
if (!owner())
|
||||
x += static_cast<float>(scroll());
|
||||
|
||||
// if top_x differs we have a rule down and we don't have to clear anything
|
||||
// if top_x differs we did it already
|
||||
if (!cleared && (top_x == int(x)) &&
|
||||
((need_update&(INIT|FULL)) || (top_baseline!=baseline) ||
|
||||
(last_drawn_width!=insetWidth))) {
|
||||
@ -378,6 +381,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
}
|
||||
|
||||
top_x = int(x);
|
||||
topx_set = true;
|
||||
if (cleared)
|
||||
frame_is_visible = false;
|
||||
|
||||
@ -509,12 +513,20 @@ void InsetText::clearFrame(Painter & pain, bool cleared) const
|
||||
|
||||
void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
|
||||
{
|
||||
if (in_update)
|
||||
if (in_update) {
|
||||
if (reinit && owner()) {
|
||||
owner()->update(bv, font, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
in_update = true;
|
||||
if (reinit) {
|
||||
need_update |= INIT;
|
||||
if (reinit || need_update == INIT) {
|
||||
need_update |= FULL;
|
||||
#if 0
|
||||
resizeLyXText(bv);
|
||||
#else
|
||||
reinitLyXText();
|
||||
#endif
|
||||
if (owner())
|
||||
owner()->update(bv, font, true);
|
||||
in_update = false;
|
||||
@ -1691,9 +1703,10 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
|
||||
|
||||
int InsetText::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const
|
||||
{
|
||||
#if 0
|
||||
int w = UpdatableInset::getMaxWidth(bv, inset);
|
||||
if (w < 0) {
|
||||
return w;
|
||||
return -1;
|
||||
}
|
||||
if (owner()) {
|
||||
w = w - top_x + owner()->x();
|
||||
@ -1701,11 +1714,16 @@ int InsetText::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const
|
||||
}
|
||||
w -= (2 * TEXT_TO_INSET_OFFSET);
|
||||
return w - top_x;
|
||||
#else
|
||||
return UpdatableInset::getMaxWidth(bv, inset);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void InsetText::setParagraphData(Paragraph * p)
|
||||
{
|
||||
// we have to unlock any locked inset otherwise we're in troubles
|
||||
the_locking_inset = 0;
|
||||
while (par) {
|
||||
Paragraph * tmp = par->next();
|
||||
delete par;
|
||||
@ -1722,7 +1740,7 @@ void InsetText::setParagraphData(Paragraph * p)
|
||||
np = np->next();
|
||||
np->setInsetOwner(this);
|
||||
}
|
||||
reinitLyXText();
|
||||
reinitLyXText(true);
|
||||
}
|
||||
|
||||
|
||||
@ -1742,7 +1760,7 @@ void InsetText::setAutoBreakRows(bool flag)
|
||||
need_update = FULL;
|
||||
if (!flag)
|
||||
removeNewlines();
|
||||
reinitLyXText();
|
||||
reinitLyXText(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1913,16 +1931,17 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
|
||||
if (bv->screen()) {
|
||||
t->first = bv->screen()->topCursorVisible(t);
|
||||
}
|
||||
if (!owner())
|
||||
if (!owner()) {
|
||||
updateLocal(bv, FULL, false);
|
||||
else
|
||||
need_update |= FULL;
|
||||
// this will scroll the screen such that the cursor becomes visible
|
||||
bv->updateScrollbar();
|
||||
} else {
|
||||
need_update |= FULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetText::reinitLyXText() const
|
||||
void InsetText::reinitLyXText(bool wrong_cursor) const
|
||||
{
|
||||
for(Cache::iterator it = cache.begin(); it != cache.end(); ++it) {
|
||||
lyx::Assert(it->second.text.get());
|
||||
@ -1930,6 +1949,11 @@ void InsetText::reinitLyXText() const
|
||||
LyXText * t = it->second.text.get();
|
||||
BufferView * bv = it->first;
|
||||
|
||||
if (wrong_cursor) {
|
||||
t->cursor.par(par);
|
||||
t->cursor.pos(0);
|
||||
t->clearSelection();
|
||||
}
|
||||
saveLyXTextState(t);
|
||||
for (Paragraph * p = par; p; p = p->next()) {
|
||||
p->resizeInsetsLyXText(bv);
|
||||
@ -1943,12 +1967,13 @@ void InsetText::reinitLyXText() const
|
||||
if (bv->screen()) {
|
||||
t->first = bv->screen()->topCursorVisible(t);
|
||||
}
|
||||
if (!owner())
|
||||
if (!owner()) {
|
||||
updateLocal(bv, FULL, false);
|
||||
else
|
||||
need_update = FULL;
|
||||
// this will scroll the screen such that the cursor becomes visible
|
||||
bv->updateScrollbar();
|
||||
} else {
|
||||
need_update = FULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ private:
|
||||
void saveLyXTextState(LyXText *) const;
|
||||
void restoreLyXTextState(BufferView *, LyXText *) const;
|
||||
///
|
||||
void reinitLyXText() const;
|
||||
void reinitLyXText(bool wrong_cursor = false) const;
|
||||
|
||||
/* Private structures and variables */
|
||||
///
|
||||
|
@ -236,6 +236,7 @@ SearchResult SearchForward(BufferView * bv, LyXText * text, string const & str,
|
||||
if (par) {
|
||||
text->setCursor(bv, par, pos);
|
||||
return SR_FOUND;
|
||||
#if 0
|
||||
} else if (text->inset_owner) {
|
||||
// test if we're inside an inset if yes unlock the inset
|
||||
// and recall us with the outside LyXText!
|
||||
@ -257,6 +258,7 @@ SearchResult SearchForward(BufferView * bv, LyXText * text, string const & str,
|
||||
} else {
|
||||
return SR_NOT_FOUND;
|
||||
}
|
||||
#endif
|
||||
} else
|
||||
return SR_NOT_FOUND;
|
||||
}
|
||||
|
@ -1963,7 +1963,8 @@ void Paragraph::resizeInsetsLyXText(BufferView * bv)
|
||||
{
|
||||
// then the insets
|
||||
for (InsetList::const_iterator cit = insetlist.begin();
|
||||
cit != insetlist.end(); ++cit) {
|
||||
cit != insetlist.end(); ++cit)
|
||||
{
|
||||
if (cit->inset) {
|
||||
if (cit->inset->isTextInset()) {
|
||||
static_cast<UpdatableInset *>
|
||||
|
Loading…
Reference in New Issue
Block a user