- 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
// 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;
void WorkArea::stopBlinkingCursor()
{
cursor_timeout_.stop();
+ hideCursor();
}
void WorkArea::startBlinkingCursor()
{
+ showCursor();
cursor_timeout_.restart();
}
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();
}
// 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();
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)
}
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();
}