resizeCurrentBuffer();
// FIXME: needed when ?
- top_y(screen().topCursorVisible(bv_->text));
+ fitCursor();
// Buffer-dependent dialogs should be updated or
// hidden. This should go here because some dialogs (eg ToC)
bool BufferView::Pimpl::fitCursor()
{
lyxerr << "BufferView::Pimpl::fitCursor." << endl;
- bool ret;
-
-#ifndef LOCK
- UpdatableInset * tli =
- static_cast<UpdatableInset *>(cursor_.innerInset());
- if (tli) {
- tli->fitInsetCursor(bv_);
- ret = true;
- } else {
- ret = screen().fitCursor(bv_->text, bv_);
+ if (screen().fitCursor(bv_)) {
+ updateScrollbar();
+ return true;
}
-#else
- ret = screen().fitCursor(bv_->text, bv_);
-#endif
-
- //dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
-
- // We need to always update, in case we did a
- // paste and we stayed anchored to a row, but
- // the actual height of the doc changed ...
- updateScrollbar();
- return ret;
+ return false;
}
resizeCurrentBuffer();
updateScrollbar();
owner_->updateLayoutChoice();
- update();
}
}
}
}
- top_y(screen().topCursorVisible(bv_->text));
+ fitCursor();
switchKeyMap();
owner_->busy(false);
// check needed to survive LyX startup
if (bv_->getLyXText()) {
- bv_->getLyXText()->redoCursor();
-
// update all 'visible' paragraphs
ParagraphList::iterator beg;
ParagraphList::iterator end;
top_y(), top_y() + workarea().workHeight(),
beg, end);
bv_->text->redoParagraphs(beg, end);
-
+ bv_->getLyXText()->redoCursor();
updateScrollbar();
}
screen().redraw(*bv_);
bv_->text->setCursor(par.pit(),
min(par->size(), saved_positions[i].par_pos));
- update();
if (i > 0)
owner_->message(bformat(_("Moved to bookmark %1$s"), tostr(i)));
}
// updateScrollbar() currently. Never mind that this is a
// pretty obfuscated way of updating t->top_y()
top_y(new_y);
- update();
}
update();
bv_->text->setCursor(0, 0);
#warning changes FIXME
- //moveCursorUpdate(false);
-
bool found = lyx::find::findNextChange(bv_);
if (found) {
owner_->getDialogs().show("changes");
cmd2.x -= inset->x();
cmd2.y -= inset->y();
res = inset->dispatch(cmd2);
- if (res.update())
+ if (res.update()) {
bv_->update();
+ bv_->cursor().updatePos();
+ }
res.update(false);
switch (res.val()) {
case FINISHED:
case FINISHED_DOWN:
theTempCursor.pop();
bv_->cursor() = theTempCursor;
- bv_->cursor().innerText()->setCursorFromCoordinates(cmd.x, cmd.y);
+ bv_->cursor().innerText()->setCursorFromCoordinates(cmd.x, top_y() + cmd.y);
+ if (bv_->fitCursor())
+ bv_->update();
return true;
default:
lyxerr << "not dispatched by inner inset val: " << res.val() << endl;
// otherwise set cursor to surrounding LyXText
if (!res.dispatched()) {
- lyxerr << "cursor is: " << bv_->cursor() << endl;
- lyxerr << "dispatching " << cmd1 << " to surrounding LyXText "
- << bv_->cursor().innerText() << endl;
- theTempCursor.innerText()->dispatch(cmd1);
- cursor_ = theTempCursor;
+ lyxerr << "temp cursor is: " << theTempCursor << endl;
+ lyxerr << "dispatching " << cmd1
+ << " to surrounding LyXText "
+ << theTempCursor.innerText() << endl;
+ bv_->cursor() = theTempCursor;
+ res = bv_->cursor().innerText()->dispatch(cmd1);
+ if (bv_->fitCursor() || res.update())
+ bv_->update();
+
//return DispatchResult(true, true);
}
-
// see workAreaKeyPress
cursor_timeout.restart();
screen().showCursor(*bv_);
- // FIXME: we should skip these when selecting
- owner_->updateLayoutChoice();
- owner_->updateToolbar();
-// fitCursor();
+ // skip these when selecting
+ if (cmd.action != LFUN_MOUSE_MOTION) {
+ owner_->updateLayoutChoice();
+ owner_->updateToolbar();
+ }
// slight hack: this is only called currently when we
// clicked somewhere, so we force through the display
case LFUN_ACCEPT_ALL_CHANGES: {
bv_->text->setCursor(0, 0);
#warning FIXME changes
- //moveCursorUpdate(false);
-
while (lyx::find::findNextChange(bv_))
bv_->getLyXText()->acceptChange();
-
update();
break;
}
case LFUN_REJECT_ALL_CHANGES: {
bv_->text->setCursor(0, 0);
#warning FIXME changes
- //moveCursorUpdate(false);
-
while (lyx::find::findNextChange(bv_))
bv_->getLyXText()->rejectChange();
-
update();
break;
}
string(),
0);
}
-
bv_->cursor().innerText()->insertInset(inset);
- update();
-
unFreezeUndo();
return true;
}