From 0e9af0297fa6b1080beadc3345915eb446933739 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Vigna?= Date: Fri, 3 Aug 2001 13:09:59 +0000 Subject: [PATCH] Some more small fixes. Hopefully we'll get there soon! git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2412 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 3 +++ src/insets/ChangeLog | 5 +++++ src/insets/insettext.C | 4 ++++ src/screen.C | 12 +++++++++--- src/text2.C | 14 ++++++++------ 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index adac2acda2..dbd3f0828e 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -981,6 +981,9 @@ void BufferView::Pimpl::update() bv_->text->status(bv_, st); screen_->update(bv_->text, bv_); } + // do this here instead of in the screen::update because of + // the above loop! + bv_->text->status(bv_, LyXText::UNCHANGED); if (fitc) fitCursor(); } diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 5abd08ff41..a622e98094 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2001-08-03 Juergen Vigna + + * insettext.C (setFont): don't call for a draw update if we're just + changing the cursor font! + 2001-08-02 Juergen Vigna * insettext.C (draw): clear the background with the right color if diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 483a7a8731..227ce17817 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -1579,6 +1579,10 @@ void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall, the_locking_inset->setFont(bv, font, toggleall, selectall); return; } + if ((!par->next() && !par->size()) || !cpar(bv)->size()) { + getLyXText(bv)->setFont(bv, font, toggleall); + return; + } bool clear = false; if (!lt) { lt = getLyXText(bv); diff --git a/src/screen.C b/src/screen.C index ba1dc7dec4..c9590cf578 100644 --- a/src/screen.C +++ b/src/screen.C @@ -432,7 +432,7 @@ bool LyXScreen::fitCursor(LyXText * text, BufferView * bv) void LyXScreen::update(LyXText * text, BufferView * bv, - int y_offset, int x_offset) + int y_offset, int x_offset) { switch (text->status()) { case LyXText::NEED_MORE_REFRESH: @@ -440,7 +440,10 @@ void LyXScreen::update(LyXText * text, BufferView * bv, int const y = max(int(text->refresh_y - text->first), 0); drawFromTo(text, bv, y, owner.height(), y_offset, x_offset); text->refresh_y = 0; - text->status(bv, LyXText::UNCHANGED); + // otherwise this is called ONLY from BufferView_pimpl(update) + // or we should see to set this flag accordingly + if (text != bv->text) + text->status(bv, LyXText::UNCHANGED); expose(0, y, owner.workWidth(), owner.height() - y); } break; @@ -452,7 +455,10 @@ void LyXScreen::update(LyXText * text, BufferView * bv, // this because if we had a major update the refresh_row could // have been set to 0! if (text->refresh_row) { - text->status(bv, LyXText::UNCHANGED); + // otherwise this is called ONLY from BufferView_pimpl(update) + // or we should see to set this flag accordingly + if (text != bv->text) + text->status(bv, LyXText::UNCHANGED); expose(0, text->refresh_y - text->first + y_offset, owner.workWidth(), text->refresh_row->height()); } diff --git a/src/text2.C b/src/text2.C index 938d9fd3a2..91d5b03c61 100644 --- a/src/text2.C +++ b/src/text2.C @@ -675,10 +675,12 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall) // Determine basis font LyXFont layoutfont; if (cursor.pos() < beginningOfMainBody(bview->buffer(), - cursor.par())) + cursor.par())) + { layoutfont = getFont(bview->buffer(), cursor.par(),-2); - else + } else { layoutfont = getFont(bview->buffer(), cursor.par(),-1); + } // Update current font real_current_font.update(font, toggleall); @@ -697,12 +699,12 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall) // and sel_end cursor setUndo(bview, Undo::EDIT, - selection.start.par(), - selection.end.par()->next()); + selection.start.par(), selection.end.par()->next()); freezeUndo(); cursor = selection.start; while (cursor.par() != selection.end.par() || - (cursor.pos() < selection.end.pos())) { + (cursor.pos() < selection.end.pos())) + { if (cursor.pos() < cursor.par()->size()) { // an open footnote should behave // like a closed one @@ -726,7 +728,7 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall) clearSelection(); setSelection(bview); setCursor(bview, tmpcursor.par(), tmpcursor.pos(), true, - tmpcursor.boundary()); + tmpcursor.boundary()); } -- 2.39.2