]> git.lyx.org Git - features.git/commitdiff
* bug fix to only do paragraph redraws, not fullscreen
authorStefan Schimanski <sts@lyx.org>
Fri, 29 Feb 2008 09:18:46 +0000 (09:18 +0000)
committerStefan Schimanski <sts@lyx.org>
Fri, 29 Feb 2008 09:18:46 +0000 (09:18 +0000)
* 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

src/BufferView.cpp
src/LyXFunc.cpp
src/frontends/LyXView.h
src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiView.h

index dbe396c0704ab5c678757c3ca2ab37f037497e72..e94d08e60f77728070c6b790be09e31d8b56d428 100644 (file)
@@ -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);
index a6eb19eac9e4406c3fa9ad1f883d41272e3d21a9..7a639d4272ea6f1b1af65946d98c548bb67ce2ee 100644 (file)
@@ -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();
                }
 
index b97f8241c840dfce59dc822d06d6f14c8586909f..c587ce1dbb43c1c5e662a067fb641f6ac8d9aed0 100644 (file)
@@ -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
index f003951cf322e2eacacf6a9d01b0ce64b4f55ead..f1c4bd3c1ab89a1f91a0f87eb1333c8f4a20d23e 100644 (file)
@@ -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 {
index 49433ce137980a7a24e7085b83bd51bd976a7001..de64048c00265f8a9030da45b0e5a937e9458aa1 100644 (file)
@@ -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:
        ///