From: Abdelrazak Younes Date: Sun, 12 Nov 2006 14:47:20 +0000 (+0000) Subject: * text.C: X-Git-Tag: 1.6.10~11908 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1fc6b32689817ad8a60d0525b2080841abefc453;p=features.git * text.C: - 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 --- diff --git a/src/BufferView.C b/src/BufferView.C index 39c8da3162..bce7e334d2 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -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; diff --git a/src/frontends/WorkArea.C b/src/frontends/WorkArea.C index 17cac2a849..3deac37bd8 100644 --- a/src/frontends/WorkArea.C +++ b/src/frontends/WorkArea.C @@ -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(); } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index dbda91f6c8..43ad7619ce 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -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(); diff --git a/src/text.C b/src/text.C index 456118fd1c..b8049a7417 100644 --- a/src/text.C +++ b/src/text.C @@ -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(); }