scroll_step = d->scrollbarParameters_.single_step;
else if (scroll_type == "page")
scroll_step = d->scrollbarParameters_.page_step;
- else
+ else {
+ dispatched = false;
return;
+ }
+
string const scroll_quantity = cmd.getArg(1);
+
if (scroll_quantity == "up")
- scrollUp(scroll_step);
+ scroll(-scroll_step);
else if (scroll_quantity == "down")
- scrollDown(scroll_step);
+ scroll(scroll_step);
+ else if (isStrInt(scroll_quantity))
+ scroll(scroll_step * convert<int>(scroll_quantity));
else {
- int const scroll_value = convert<int>(scroll_quantity);
- if (scroll_value)
- scroll(scroll_step * scroll_value);
+ dispatched = false;
+ return;
}
+
dr.screenUpdate(Update::ForceDraw);
dr.forceBufferUpdate();
break;
}
-int BufferView::scrollDown(int pixels)
-{
- d->anchor_ypos_ -= pixels;
- return -pixels;
-}
-
-
-int BufferView::scrollUp(int pixels)
-{
- d->anchor_ypos_ += pixels;
- return pixels;
-}
-
-
bool BufferView::setCursorFromRow(int row)
{
TexRow::TextEntry start, end;
/// Ensure the passed cursor \p dit is visible.
/// This method will automatically scroll and update the BufferView
/// (metrics+drawing) if needed.
- /// \param how Use this scroll strategy
+ /// \param how: where the cursor should appear (visible/top/center)
void showCursor(DocIterator const & dit, ScrollType how);
/// Scroll to the cursor.
- /// \param how Use this scroll strategy
+ /// This only updates the anchor vertical position, but does not
+ /// recompute metrics nor trigger a screen refresh.
+ /// \param how: where the cursor should appear (visible/top/center)
/// \return true if screen was scrolled
bool scrollToCursor(DocIterator const & dit, ScrollType how);
- /// scroll down document by the given number of pixels.
- int scrollDown(int pixels);
- /// scroll up document by the given number of pixels.
- int scrollUp(int pixels);
- /// scroll document by the given number of pixels.
+ /// scroll the view by the given number of pixels. This only
+ /// updates the anchor vertical position, but does not recompute
+ /// metrics nor trigger a screen refresh.
int scroll(int pixels);
/// Scroll the view by a number of pixels.
void scrollDocView(int pixels);