mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
This was an attempt to fix #2743 without re-working the InsetBibitem mess. It didn't work, so we have to do that. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38702 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b44fe8b74b
commit
88cdfb0d42
@ -375,6 +375,21 @@ bool TextMetrics::redoParagraph(pit_type const pit)
|
|||||||
main_text_ = (text_ == &buffer.text());
|
main_text_ = (text_ == &buffer.text());
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
|
// FIXME: This check ought to be done somewhere else. It is the reason
|
||||||
|
// why text_ is not const. But then, where else to do it?
|
||||||
|
// Well, how can you end up with either (a) a biblio environment that
|
||||||
|
// has no InsetBibitem or (b) a biblio environment with more than one
|
||||||
|
// InsetBibitem? I think the answer is: when paragraphs are merged;
|
||||||
|
// when layout is set; when material is pasted.
|
||||||
|
int const moveCursor = par.checkBiblio(buffer);
|
||||||
|
if (moveCursor > 0)
|
||||||
|
const_cast<Cursor &>(bv_->cursor()).posForward();
|
||||||
|
else if (moveCursor < 0) {
|
||||||
|
Cursor & cursor = const_cast<Cursor &>(bv_->cursor());
|
||||||
|
if (cursor.pos() >= -moveCursor)
|
||||||
|
cursor.posBackward();
|
||||||
|
}
|
||||||
|
|
||||||
// Optimisation: this is used in the next two loops
|
// Optimisation: this is used in the next two loops
|
||||||
// so better to calculate that once here.
|
// so better to calculate that once here.
|
||||||
int const right_margin = rightMargin(pm);
|
int const right_margin = rightMargin(pm);
|
||||||
|
@ -1103,26 +1103,9 @@ void GuiApplication::dispatch(FuncRequest const & cmd)
|
|||||||
|
|
||||||
BufferView * bv = current_view_->currentBufferView();
|
BufferView * bv = current_view_->currentBufferView();
|
||||||
if (bv) {
|
if (bv) {
|
||||||
Cursor & cursor = bv->cursor();
|
if (dr.needBufferUpdate()) {
|
||||||
Buffer & buf = bv->buffer();
|
bv->cursor().clearBufferUpdate();
|
||||||
|
bv->buffer().updateBuffer();
|
||||||
// FIXME
|
|
||||||
// This check out to be done somewhere else. It got moved here
|
|
||||||
// from TextMetrics.cpp, where it definitely didn't need to be.
|
|
||||||
// Actually, this test ought not to be done at all, since the
|
|
||||||
// whole InsetBibitem business is a mess. But that is a different
|
|
||||||
// story.
|
|
||||||
int moveCursor = 0;
|
|
||||||
if (cursor.inTexted()) {
|
|
||||||
moveCursor = cursor.paragraph().checkBiblio(buf);
|
|
||||||
if (moveCursor > 0)
|
|
||||||
cursor.posForward();
|
|
||||||
else if (moveCursor < 0 && cursor.pos() >= -moveCursor)
|
|
||||||
cursor.posBackward();
|
|
||||||
}
|
|
||||||
if (moveCursor != 0 || dr.needBufferUpdate()) {
|
|
||||||
cursor.clearBufferUpdate();
|
|
||||||
buf.updateBuffer();
|
|
||||||
}
|
}
|
||||||
// BufferView::update() updates the ViewMetricsInfo and
|
// BufferView::update() updates the ViewMetricsInfo and
|
||||||
// also initializes the position cache for all insets in
|
// also initializes the position cache for all insets in
|
||||||
|
Loading…
Reference in New Issue
Block a user