d->scrollbarParameters_.position = 0;
// The reference is the top position so we remove one page.
- d->scrollbarParameters_.max -= d->scrollbarParameters_.page_step;
+ if (lyxrc.scroll_below_document)
+ d->scrollbarParameters_.max -= minVisiblePart();
+ else
+ d->scrollbarParameters_.max -= d->scrollbarParameters_.page_step;
}
break;
}
- case LFUN_NEXT_INSET_TOGGLE:
case LFUN_NEXT_INSET_MODIFY: {
// this is the real function we want to invoke
FuncRequest tmpcmd = cmd;
- tmpcmd.action = (cmd.action == LFUN_NEXT_INSET_TOGGLE)
- ? LFUN_INSET_TOGGLE : LFUN_INSET_MODIFY;
+ tmpcmd.action = LFUN_INSET_MODIFY;
// if there is an inset at cursor, see whether it
// handles the lfun, other start from scratch
Inset * inset = cur.nextInset();
case LFUN_BRANCH_ACTIVATE:
case LFUN_BRANCH_DEACTIVATE: {
- bool enable = false;
+ BranchList const & branchList = buffer_.params().branchlist();
docstring const branchName = cmd.argument();
- if (!branchName.empty())
- enable = buffer_.params().branchlist().find(branchName);
- flag.setEnabled(enable);
+ flag.setEnabled(!branchName.empty()
+ && branchList.find(branchName));
break;
}
processUpdateFlags(Update::SinglePar | Update::FitCursor);
break;
}
- case LFUN_NEXT_INSET_TOGGLE: {
- // create the the real function we want to invoke
- FuncRequest tmpcmd = cmd;
- tmpcmd.action = LFUN_INSET_TOGGLE;
- // if there is an inset at cursor, see whether it
- // wants to toggle.
- Inset * inset = cur.nextInset();
- if (inset) {
- if (inset->isActive()) {
- Cursor tmpcur = cur;
- tmpcur.pushBackward(*inset);
- inset->dispatch(tmpcur, tmpcmd);
- if (tmpcur.result().dispatched())
- cur.dispatched();
- } else
- inset->dispatch(cur, tmpcmd);
- }
- // if it did not work, try the underlying inset.
- if (!inset || !cur.result().dispatched())
- cur.dispatch(tmpcmd);
-
- if (!cur.result().dispatched())
- // It did not work too; no action needed.
- break;
- cur.clearSelection();
- processUpdateFlags(Update::SinglePar | Update::FitCursor);
- break;
- }
-
case LFUN_NEXT_INSET_MODIFY: {
// create the the real function we want to invoke
FuncRequest tmpcmd = cmd;
case LFUN_BRANCH_ACTIVATE:
case LFUN_BRANCH_DEACTIVATE:
+ if (cmd.argument().empty())
+ return false;
buffer_.dispatch(cmd);
processUpdateFlags(Update::Force);
break;
}
+int BufferView::minVisiblePart()
+{
+ return 2 * defaultRowHeight();
+}
+
+
int BufferView::scroll(int y)
{
if (y > 0)
{
Text * text = &buffer_.text();
TextMetrics & tm = d->text_metrics_[text];
- int ymax = height_ + offset;
+ int const ymax = height_ + offset;
while (true) {
pair<pit_type, ParagraphMetrics const *> last = tm.last();
int bottom_pos = last.second->position() + last.second->descent();
+ if (lyxrc.scroll_below_document)
+ bottom_pos += height_ - minVisiblePart();
if (last.first + 1 == int(text->paragraphs().size())) {
if (bottom_pos <= height_)
return 0;