From b1df2bd306f58296d8954ef44d040aaaf5fc8c36 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 14 Oct 2010 15:02:48 +0000 Subject: [PATCH] Move the screen redraw call out of the selection-setting routine. This avoids multiple screen redraws in some cases. If someone knows how to fix the FIXMEs in GuiErrorList and GuiSpellcheker, I'd really appreciate it. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35651 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 7 +------ src/frontends/qt4/GuiErrorList.cpp | 3 ++- src/frontends/qt4/GuiSpellchecker.cpp | 4 +++- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 4fcadeb824..b58a980ecc 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1532,9 +1532,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr) istringstream iss(to_utf8(cmd.argument())); iss >> opt; if (findAdv(this, opt)) - cur.dispatched(); - else - cur.undispatched(); + dr.screenUpdate(Update::Force | Update::FitCursor); break; } @@ -2344,9 +2342,6 @@ void BufferView::putSelectionAt(DocIterator const & cur, } else d->cursor_.setSelection(d->cursor_, length); } - // Ensure a redraw happens in any case because the new selection could - // possibly be on the same screen as the previous selection. - processUpdateFlags(Update::Force | Update::FitCursor); } diff --git a/src/frontends/qt4/GuiErrorList.cpp b/src/frontends/qt4/GuiErrorList.cpp index 0206025aa2..2038500b47 100644 --- a/src/frontends/qt4/GuiErrorList.cpp +++ b/src/frontends/qt4/GuiErrorList.cpp @@ -180,8 +180,9 @@ bool GuiErrorList::goTo(int item) pos_type const range = end - start; dit.pos() = start; BufferView * bv = const_cast(bufferview()); - // FIXME: If we used an LFUN, we would not need this line: + // FIXME: If we used an LFUN, we would not need these lines: bv->putSelectionAt(dit, range, false); + bv->processUpdateFlags(Update::Force | Update::FitCursor); return true; } diff --git a/src/frontends/qt4/GuiSpellchecker.cpp b/src/frontends/qt4/GuiSpellchecker.cpp index 4059a7be93..cfb9f6812a 100644 --- a/src/frontends/qt4/GuiSpellchecker.cpp +++ b/src/frontends/qt4/GuiSpellchecker.cpp @@ -325,10 +325,12 @@ void GuiSpellchecker::check() d->ui.languageCO->setCurrentIndex(pos); // FIXME: if we used a lfun like in find/replace, dispatch would do - // that for us + // all of this for us int const size = to.pos() - from.pos(); BufferView * bv = const_cast(bufferview()); bv->putSelectionAt(from, size, false); + bv->processUpdateFlags(Update::Force | Update::FitCursor); + }