Fixes #836. Move to line boundary in _scroll{down,up}_timeout() not _scroll().

This commit is contained in:
RichardHitt 2013-11-14 19:18:07 -08:00
parent 1aca24f3de
commit 3821e7a750

View File

@ -1341,6 +1341,7 @@ gtk_xtext_scrolldown_timeout (GtkXText * xtext)
return 0; return 0;
} }
adj->value = (int)adj->value; /* Align to line boundary */
xtext->select_start_y -= xtext->fontsize; xtext->select_start_y -= xtext->fontsize;
xtext->select_start_adj++; xtext->select_start_adj++;
adj->value++; adj->value++;
@ -1373,6 +1374,7 @@ gtk_xtext_scrollup_timeout (GtkXText * xtext)
return 0; return 0;
} }
adj->value = (int)adj->value; /* Align to line boundary */
xtext->select_start_y += xtext->fontsize; xtext->select_start_y += xtext->fontsize;
xtext->select_start_adj--; xtext->select_start_adj--;
adj->value--; adj->value--;
@ -2125,14 +2127,14 @@ gtk_xtext_scroll (GtkWidget *widget, GdkEventScroll *event)
new_value = xtext->adj->value - (xtext->adj->page_increment / 10); new_value = xtext->adj->value - (xtext->adj->page_increment / 10);
if (new_value < xtext->adj->lower) if (new_value < xtext->adj->lower)
new_value = xtext->adj->lower; new_value = xtext->adj->lower;
gtk_adjustment_set_value (xtext->adj, (int)new_value); gtk_adjustment_set_value (xtext->adj, new_value);
} }
else if (event->direction == GDK_SCROLL_DOWN) /* mouse wheel pageDn */ else if (event->direction == GDK_SCROLL_DOWN) /* mouse wheel pageDn */
{ {
new_value = xtext->adj->value + (xtext->adj->page_increment / 10); new_value = xtext->adj->value + (xtext->adj->page_increment / 10);
if (new_value > (xtext->adj->upper - xtext->adj->page_size)) if (new_value > (xtext->adj->upper - xtext->adj->page_size))
new_value = xtext->adj->upper - xtext->adj->page_size; new_value = xtext->adj->upper - xtext->adj->page_size;
gtk_adjustment_set_value (xtext->adj, (int)new_value); gtk_adjustment_set_value (xtext->adj, new_value);
} }
return FALSE; return FALSE;