Commit fe622071 authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

update cursor_y_pos with clamped delta rather than theoretical delta

2002-01-16  Havoc Pennington  <hp@redhat.com>
	* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
	cursor_y_pos with clamped delta rather than theoretical delta
	(#68788). Also, if we can't page up/down further then jump
	to top/bottom of the document.
parent 396f5ab1
2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
cursor_y_pos with clamped delta rather than theoretical delta
(#68788). Also, if we can't page up/down further then jump
to top/bottom of the document.
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
......
2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
cursor_y_pos with clamped delta rather than theoretical delta
(#68788). Also, if we can't page up/down further then jump
to top/bottom of the document.
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
......
2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
cursor_y_pos with clamped delta rather than theoretical delta
(#68788). Also, if we can't page up/down further then jump
to top/bottom of the document.
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
......
2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
cursor_y_pos with clamped delta rather than theoretical delta
(#68788). Also, if we can't page up/down further then jump
to top/bottom of the document.
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
......
2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
cursor_y_pos with clamped delta rather than theoretical delta
(#68788). Also, if we can't page up/down further then jump
to top/bottom of the document.
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
......
2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
cursor_y_pos with clamped delta rather than theoretical delta
(#68788). Also, if we can't page up/down further then jump
to top/bottom of the document.
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
......
2002-01-16 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
cursor_y_pos with clamped delta rather than theoretical delta
(#68788). Also, if we can't page up/down further then jump
to top/bottom of the document.
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
......
......@@ -4459,6 +4459,7 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
gint count)
{
gdouble newval;
gdouble oldval;
GtkAdjustment *adj;
gint cursor_x_pos, cursor_y_pos;
GtkTextIter new_insert;
......@@ -4486,22 +4487,38 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
gtk_text_layout_validate_yrange (text_view->layout, &anchor, y0, y1);
/* FIXME do we need to update the adjustment ranges here? */
gtk_text_view_get_virtual_cursor_pos (text_view, &cursor_x_pos, &cursor_y_pos);
newval = adj->value;
newval += count * adj->page_increment;
if (count < 0 && adj->value <= (adj->lower + 1e-12))
{
/* already at top, just be sure we are at offset 0 */
gtk_text_buffer_get_start_iter (get_buffer (text_view), &new_insert);
gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
}
else if (count > 0 && adj->value >= (adj->upper - adj->page_size - 1e-12))
{
/* already at bottom, just be sure we are at the end */
gtk_text_buffer_get_end_iter (get_buffer (text_view), &new_insert);
gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
}
else
{
gtk_text_view_get_virtual_cursor_pos (text_view, &cursor_x_pos, &cursor_y_pos);
cursor_y_pos += newval - adj->value;
set_adjustment_clamped (adj, newval);
newval = adj->value;
oldval = adj->value;
newval += count * adj->page_increment;
gtk_text_layout_get_iter_at_pixel (text_view->layout, &new_insert, cursor_x_pos, cursor_y_pos);
clamp_iter_onscreen (text_view, &new_insert);
gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
set_adjustment_clamped (adj, newval);
cursor_y_pos += adj->value - oldval;
gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, cursor_y_pos);
gtk_text_layout_get_iter_at_pixel (text_view->layout, &new_insert, cursor_x_pos, cursor_y_pos);
clamp_iter_onscreen (text_view, &new_insert);
gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, cursor_y_pos);
}
/* Adjust to have the cursor _entirely_ onscreen, move_mark_onscreen
* only guarantees 1 pixel onscreen.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment