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;
-
- int x,y;
- bv_->cursor().getPos(x, y);
-
- if (y < top_y() || y > top_y() + workarea().workHeight()) {
- int newtop = y - workarea().workHeight() / 2;
- newtop = std::max(0, newtop);
- top_y(newtop);
+ if (screen().fitCursor(bv_)) {
updateScrollbar();
return true;
}
return false;
-
-// dead code below
- bool ret;
-#if 0
- UpdatableInset * tli =
- static_cast<UpdatableInset *>(cursor_.innerInset());
- if (tli) {
- tli->fitInsetCursor(bv_);
- ret = true;
- } else {
- ret = screen().fitCursor(bv_->text, bv_);
- }
-#endif
-#if 0
- 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;
}
resizeCurrentBuffer();
updateScrollbar();
owner_->updateLayoutChoice();
- update();
}
}
}
}
- top_y(screen().topCursorVisible(bv_->text));
+ fitCursor();
switchKeyMap();
owner_->busy(false);
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");
theTempCursor.pop();
bv_->cursor() = theTempCursor;
bv_->cursor().innerText()->setCursorFromCoordinates(cmd.x, top_y() + cmd.y);
- bv_->cursor().updatePos();
- bv_->fitCursor();
+ 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 << "temp cursor is: " << theTempCursor << endl;
lyxerr << "dispatching " << cmd1
<< " to surrounding LyXText "
- << bv_->cursor().innerText() << endl;
+ << theTempCursor.innerText() << endl;
bv_->cursor() = theTempCursor;
- theTempCursor.dispatch(cmd1);
- bv_->update();
- bv_->cursor().updatePos();
+ 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;
}