mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 11:52:25 +00:00
* 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
This commit is contained in:
parent
29012f2596
commit
1fc6b32689
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
11
src/text.C
11
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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user