From: Stefan Schimanski Date: Fri, 29 Feb 2008 09:18:46 +0000 (+0000) Subject: * bug fix to only do paragraph redraws, not fullscreen X-Git-Tag: 1.6.10~5981 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8c4b08920e597dea2c056e36673acde1081bc9ef;p=features.git * bug fix to only do paragraph redraws, not fullscreen * avoid an extra redraw due to completion when typing git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23349 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView.cpp b/src/BufferView.cpp index dbe396c070..e94d08e60f 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2221,7 +2221,7 @@ void BufferView::setInlineCompletion(Cursor & cur, DocIterator const & pos, // set update flags if (changed) { - if (singlePar && !(cur.disp_.update() | Update::Force)) + if (singlePar && !(cur.disp_.update() & Update::Force)) cur.updateFlags(cur.disp_.update() | Update::SinglePar); else cur.updateFlags(cur.disp_.update() | Update::Force); diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index a6eb19eac9..7a639d4272 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -367,19 +367,11 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state) dispatch(FuncRequest(LFUN_SELF_INSERT, arg, FuncRequest::KEYBOARD)); LYXERR(Debug::KEY, "SelfInsert arg[`" << to_utf8(arg) << "']"); - lyx_view_->updateCompletion(true, true); } } else { dispatch(func); if (!lyx_view_) return; - if (func.action == LFUN_CHAR_DELETE_BACKWARD) - // backspace is not a self-insertion. But it - // still should not hide the completion popup. - // FIXME: more clever way to detect those movements - lyx_view_->updateCompletion(false, true); - else - lyx_view_->updateCompletion(false, false); } if (lyx_view_) @@ -1713,6 +1705,18 @@ void LyXFunc::dispatch(FuncRequest const & cmd) view()->cursor().fixIfBroken(); } + // update completion. We do it here and not in + // processKeySym to avoid another redraw just for a + // changed inline completion + if (cmd.origin == FuncRequest::KEYBOARD) { + if (cmd.action == LFUN_SELF_INSERT) + lyx_view_->updateCompletion(view()->cursor(), true, true); + else if (cmd.action == LFUN_CHAR_DELETE_BACKWARD) + lyx_view_->updateCompletion(view()->cursor(), false, true); + else + lyx_view_->updateCompletion(view()->cursor(), false, false); + } + updateFlags = view()->cursor().result().update(); } diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h index b97f8241c8..c587ce1dbb 100644 --- a/src/frontends/LyXView.h +++ b/src/frontends/LyXView.h @@ -21,6 +21,7 @@ namespace support { class FileName; } class Buffer; class BufferView; +class Cursor; class FuncStatus; class FuncRequest; class Inset; @@ -92,8 +93,9 @@ public: /// Update the completion popup and the inline completion state. /// If \c start is true, then a new completion might be started. /// If \c keep is true, an active completion will be kept active - /// even though the cursor moved. - virtual void updateCompletion(bool start, bool keep) = 0; + /// even though the cursor moved. The update flags of \c cur might + /// be changed. + virtual void updateCompletion(Cursor & cur, bool start, bool keep) = 0; private: /// noncopyable diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index f003951cf3..f1c4bd3c1a 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -1969,10 +1969,10 @@ void GuiView::restartCursor() } -void GuiView::updateCompletion(bool start, bool keep) +void GuiView::updateCompletion(Cursor & cur, bool start, bool keep) { if (d.current_work_area_) - d.current_work_area_->completer().updateVisibility(start, keep); + d.current_work_area_->completer().updateVisibility(cur, start, keep); } namespace { diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 49433ce137..de64048c00 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -31,6 +31,7 @@ class QShowEvent; namespace lyx { +class Cursor; class ToolbarInfo; namespace frontend { @@ -244,7 +245,7 @@ public: void disconnectDialog(std::string const & name); /// - void updateCompletion(bool start, bool keep); + void updateCompletion(Cursor & cur, bool start, bool keep); private: ///