{
if (!right)
{
- if (startRes < jump)
+ if (startRes < 1)
{
return false;
}
-
- setStartRes(startRes - jump);
+ int jumpto = Math.max(startRes - jump, 0);
+ setStartRes(jumpto);
}
else
{
- if (endRes >= getVisibleAlignmentWidth() - jump)
+ int vawidth = getVisibleAlignmentWidth();
+ if (endRes >= vawidth - 1)
{
return false;
}
- setStartRes(startRes + jump);
+ int jumpto = Math.min(startRes + jump,
+ vawidth - (endRes - startRes + 1));
+ setStartRes(jumpto);
}
return true;