]> git.lyx.org Git - features.git/commitdiff
* text.C:
authorAbdelrazak Younes <younes@lyx.org>
Sun, 12 Nov 2006 14:47:20 +0000 (14:47 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 12 Nov 2006 14:47:20 +0000 (14:47 +0000)
  - LyXText::breakParagraph(): Redo paragraphs before setCursor()
  - LyXText::insertChar(): ditto

* lyxfunc.C: take into account BufferView::update() returned value for WorkArea redrawing.

* BufferView::update(): we also need a second step in singlePar mode.

* WorkArea.C
  - startBlinkingCursor(): also show the cursor
  - stopBlinkingCursor(): also remove the visible cursor
  - processKeySym(): stop and start the cursor blinking instead of merely hide and show it.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15884 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.C
src/frontends/WorkArea.C
src/lyxfunc.C
src/text.C

index 39c8da3162fa7937a02aed839964b2219a31f679..bce7e334d2c7f41d2cdf5703fe6ce3f22328873b 100644 (file)
@@ -367,7 +367,7 @@ bool BufferView::update(Update::flags flags)
 
        // The second drawing step is done in WorkArea::redraw() if needed.
        bool const need_second_step =
-               (flags & (Update::Force | Update::FitCursor | Update::MultiParSel))
+               (flags & (Update::SinglePar | Update::Force | Update::FitCursor | Update::MultiParSel))
                && (fitCursor() || multiParSel());
 
        return need_second_step;
index 17cac2a849c0214617a3ed0f491e02eaa22176da..3deac37bd88c773889c7a29d5584b7702b0d8ade 100644 (file)
@@ -120,11 +120,13 @@ BufferView const & WorkArea::bufferView() const
 void WorkArea::stopBlinkingCursor()
 {
        cursor_timeout_.stop();
+       hideCursor();
 }
 
 
 void WorkArea::startBlinkingCursor()
 {
+       showCursor();
        cursor_timeout_.restart();
 }
 
@@ -165,20 +167,17 @@ void WorkArea::redraw(bool singlePar)
 void WorkArea::processKeySym(LyXKeySymPtr key,
                                                         key_modifier::state state)
 {
-       hideCursor();
+       // In order to avoid bad surprise in the middle of an operation, we better stop
+       // the blinking cursor.
+       stopBlinkingCursor();
 
        theLyXFunc().setLyXView(&lyx_view_);
        theLyXFunc().processKeySym(key, state);
 
-       /* This is perhaps a bit of a hack. When we move
-        * around, or type, it's nice to be able to see
-        * the cursor immediately after the keypress. So
-        * we reset the toggle timeout and force the visibility
-        * of the cursor. Note we cannot do this inside
-        * dispatch() itself, because that's called recursively.
+       /* When we move around, or type, it's nice to be able to see
+        * the cursor immediately after the keypress.
         */
-//     if (buffer_view_->buffer())
-       toggleCursor();
+       startBlinkingCursor();
 }
 
 
index dbda91f6c8d513a28b6d636f8e9c8cf4dddacc09..43ad7619ce8387fa3fab8d37f069f6d3e32771de 100644 (file)
@@ -1717,7 +1717,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        // in (at least partially) visible top-level paragraphs.
                        bool needSecondUpdate = false;
                        if (updateFlags != Update::None)
-                               view()->update(updateFlags);
+                               needSecondUpdate = view()->update(updateFlags);
                        else
                                needSecondUpdate = view()->fitCursor();
 
index 456118fd1ca84c7af8166f77a849a6144e1fb8e5..b8049a7417768a21aba308e2876cab47799d0e1a 100644 (file)
@@ -1149,6 +1149,12 @@ void LyXText::breakParagraph(LCursor & cur, bool keep_layout)
                        Change(Change::INSERTED));
        }
 
+       // FIXME: back spacing have nothing to do with setting a cursor.
+       // Because of the mix between the model (the paragraph contents) and the
+       // view (the paragraph breaking in rows, we have to do this here.
+       redoParagraph(cur.bv(), cpit);
+       redoParagraph(cur.bv(), cpit + 1);
+
        // This check is necessary. Otherwise the new empty paragraph will
        // be deleted automatically. And it is more friendly for the user!
        if (cur.pos() != 0 || isempty)
@@ -1242,6 +1248,11 @@ void LyXText::insertChar(LCursor & cur, char_type c)
        }
 
        par.insertChar(cur.pos(), c, current_font, cur.buffer().params().trackChanges);
+
+       // FIXME: back spacing have nothing to do with setting a cursor.
+       // Because of the mix between the model (the paragraph contents) and the
+       // view (the paragraph breaking in rows, we have to do this here.
+       redoParagraph(cur.bv(), cur.pit());
        setCursor(cur, cur.pit(), cur.pos() + 1, false, cur.boundary());
        charInserted();
 }