update adjustments after validating destination yrange; fixes #53918 (This

2001-09-07  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktextview.c (gtk_text_view_flush_scroll): update
	adjustments after validating destination yrange; fixes #53918
	(This may cause other issues, but I hope it won't)

2001-09-05  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
	line into start line, update the character counts in parent nodes;
	caused a bug when end and start line had different parent nodes.

2001-08-30  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
	assertion that tag is in a table
This commit is contained in:
Havoc Pennington 2001-09-07 21:39:18 +00:00 committed by Havoc Pennington
parent d8e3d58d42
commit f1427cd9bb
15 changed files with 249 additions and 62 deletions

View File

@ -1,3 +1,20 @@
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_flush_scroll): update
adjustments after validating destination yrange; fixes #53918
(This may cause other issues, but I hope it won't)
2001-09-05 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
line into start line, update the character counts in parent nodes;
caused a bug when end and start line had different parent nodes.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
assertion that tag is in a table
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
@ -466,7 +483,7 @@ Tue Aug 21 12:43:29 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.

View File

@ -1,3 +1,20 @@
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_flush_scroll): update
adjustments after validating destination yrange; fixes #53918
(This may cause other issues, but I hope it won't)
2001-09-05 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
line into start line, update the character counts in parent nodes;
caused a bug when end and start line had different parent nodes.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
assertion that tag is in a table
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
@ -466,7 +483,7 @@ Tue Aug 21 12:43:29 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.

View File

@ -1,3 +1,20 @@
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_flush_scroll): update
adjustments after validating destination yrange; fixes #53918
(This may cause other issues, but I hope it won't)
2001-09-05 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
line into start line, update the character counts in parent nodes;
caused a bug when end and start line had different parent nodes.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
assertion that tag is in a table
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
@ -466,7 +483,7 @@ Tue Aug 21 12:43:29 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.

View File

@ -1,3 +1,20 @@
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_flush_scroll): update
adjustments after validating destination yrange; fixes #53918
(This may cause other issues, but I hope it won't)
2001-09-05 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
line into start line, update the character counts in parent nodes;
caused a bug when end and start line had different parent nodes.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
assertion that tag is in a table
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
@ -466,7 +483,7 @@ Tue Aug 21 12:43:29 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.

View File

@ -1,3 +1,20 @@
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_flush_scroll): update
adjustments after validating destination yrange; fixes #53918
(This may cause other issues, but I hope it won't)
2001-09-05 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
line into start line, update the character counts in parent nodes;
caused a bug when end and start line had different parent nodes.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
assertion that tag is in a table
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
@ -466,7 +483,7 @@ Tue Aug 21 12:43:29 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.

View File

@ -1,3 +1,20 @@
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_flush_scroll): update
adjustments after validating destination yrange; fixes #53918
(This may cause other issues, but I hope it won't)
2001-09-05 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
line into start line, update the character counts in parent nodes;
caused a bug when end and start line had different parent nodes.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
assertion that tag is in a table
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
@ -466,7 +483,7 @@ Tue Aug 21 12:43:29 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.

View File

@ -1,3 +1,20 @@
2001-09-07 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_flush_scroll): update
adjustments after validating destination yrange; fixes #53918
(This may cause other issues, but I hope it won't)
2001-09-05 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end
line into start line, update the character counts in parent nodes;
caused a bug when end and start line had different parent nodes.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add
assertion that tag is in a table
Fri Sep 7 12:48:56 2001 Matthias Clasen <matthiasc@poet.de>
* gdk/x11/gdkkeys-x11.c (get_direction): Don't call
@ -466,7 +483,7 @@ Tue Aug 21 12:43:29 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (all_loaders): Add tga loader,
patch by Nicola Girardi. (#56067)
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>>
Tue Aug 21 02:57:13 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_button_press): Fix up selection
a little. More needs to be done tomorrow.

View File

@ -1646,13 +1646,6 @@ arrow.
@show_toggle_indicator: unused
@show_submenu_indicator: whether to show the arrow or not
<!-- ##### MACRO gtk_notebook_set_page ##### -->
<para>
</para>
@notebook:
@page_num:
<!-- ##### FUNCTION gtk_object_arg_get ##### -->
<para>
Private function to get an argument and argument info from an object.
@ -2370,14 +2363,6 @@ fundamental type.
@window:
@Returns:
<!-- ##### FUNCTION gtk_window_get_resizeable ##### -->
<para>
</para>
@window:
@Returns:
<!-- ##### FUNCTION gtk_window_set_decorations_hint ##### -->
<para>
@ -2394,12 +2379,3 @@ fundamental type.
@window:
@functions:
<!-- ##### FUNCTION gtk_window_set_resizeable ##### -->
<para>
</para>
@window:
@setting:
@resizeable:

View File

@ -96,9 +96,9 @@ Creates a new #GtkMenu.
Adds a new #GtkMenuItem to the end of the menu's item list.
</para>
<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
<!-- # Unused Parameters # -->
@m:
@c:
@ -108,8 +108,8 @@ Adds a new #GtkMenuItem to the end of the menu's item list.
Adds a new #GtkMenuItem to the beginning of the menu's item list.
</para>
@menu_child:
<!-- # Unused Parameters # -->
@menu_child:
@m:
@c:
@menu: a #GtkMenu.
@ -122,10 +122,10 @@ Adds a new #GtkMenuItem to the menu's item list at the position
indicated by @position.
</para>
<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
@pos:
<!-- # Unused Parameters # -->
@position: The position in the item list where @child is added.
Positions are numbered from 0 to n-1.

View File

@ -132,6 +132,15 @@ Deprecated compatibility macro.
@Returns:
<!-- ##### MACRO gtk_notebook_set_page ##### -->
<para>
</para>
<!-- # Unused Parameters # -->
@notebook:
@page_num:
<!-- ##### FUNCTION gtk_notebook_next_page ##### -->
<para>
</para>

View File

@ -128,6 +128,26 @@ the child gets a larger allocation than it requests.
it's larger
<!-- ##### FUNCTION gtk_window_set_resizeable ##### -->
<para>
</para>
@window:
@setting:
<!-- # Unused Parameters # -->
@resizeable:
<!-- ##### FUNCTION gtk_window_get_resizeable ##### -->
<para>
</para>
@window:
@Returns:
<!-- ##### FUNCTION gtk_window_add_accel_group ##### -->
<para>

View File

@ -102,7 +102,12 @@ struct _NodeData {
gint height;
gint width : 24;
/* boolean indicating whether the height/width need to be recomputed */
/* boolean indicating whether the lines below this node are in need of validation.
* However, width/height should always represent the current total width and
* max height for lines below this node; the valid flag indicates whether the
* width/height on the lines needs recomputing, not whether the totals
* need recomputing.
*/
gint valid : 8;
};
@ -573,6 +578,9 @@ _gtk_text_btree_delete (GtkTextIter *start,
tree = _gtk_text_iter_get_btree (start);
if (gtk_debug_flags & GTK_DEBUG_TEXT)
_gtk_text_btree_check (tree);
{
/*
* The code below is ugly, but it's needed to make sure there
@ -701,6 +709,9 @@ _gtk_text_btree_delete (GtkTextIter *start,
for (node = curnode; node != NULL;
node = node->parent)
{
/* Don't update node->num_chars, because
* that was done when we deleted the segments.
*/
node->num_lines -= 1;
}
@ -791,21 +802,32 @@ _gtk_text_btree_delete (GtkTextIter *start,
{
BTreeView *view;
GtkTextBTreeNode *ancestor_node;
GtkTextLine *prevline;
int chars_moved;
/* last_seg was appended to start_line up at the top of this function */
chars_moved = 0;
for (seg = last_seg; seg != NULL;
seg = seg->next)
{
chars_moved += seg->char_count;
if (seg->type->lineChangeFunc != NULL)
{
(*seg->type->lineChangeFunc)(seg, end_line);
}
}
for (node = start_line->parent; node != NULL;
node = node->parent)
{
node->num_chars += chars_moved;
}
curnode = end_line->parent;
for (node = curnode; node != NULL;
node = node->parent)
{
node->num_chars -= chars_moved;
node->num_lines--;
}
curnode->num_children--;
@ -881,6 +903,9 @@ _gtk_text_btree_delete (GtkTextIter *start,
view = view->next;
}
/* avoid dangling pointer */
deleted_lines = NULL;
gtk_text_btree_rebalance (tree, curnode);
}

View File

@ -1945,6 +1945,7 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
GtkTextTag *tag = tags[n];
GtkTextAttributes *vals = tag->values;
g_assert (tag->table != NULL);
if (n > 0)
g_assert (tags[n]->priority > tags[n-1]->priority);

View File

@ -288,6 +288,7 @@ static void gtk_text_view_queue_scroll (GtkTextView *text_view,
gdouble yalign);
static gboolean gtk_text_view_flush_scroll (GtkTextView *text_view);
static void gtk_text_view_update_adjustments (GtkTextView *text_view);
/* Container methods */
static void gtk_text_view_add (GtkContainer *container,
@ -1233,6 +1234,8 @@ gtk_text_view_get_line_at_y (GtkTextView *text_view,
static gboolean
set_adjustment_clamped (GtkAdjustment *adj, gdouble val)
{
DV (g_print (" Setting adj to raw value %g\n", val));
/* We don't really want to clamp to upper; we want to clamp to
upper - page_size which is the highest value the scrollbar
will let us reach. */
@ -1244,6 +1247,7 @@ set_adjustment_clamped (GtkAdjustment *adj, gdouble val)
if (val != adj->value)
{
DV (g_print (" Setting adj to clamped value %g\n", val));
gtk_adjustment_set_value (adj, val);
return TRUE;
}
@ -1306,7 +1310,7 @@ gtk_text_view_scroll_to_iter (GtkTextView *text_view,
if (!GTK_WIDGET_MAPPED (widget))
{
g_warning ("%s: calling this function before mapping the GtkTextView doesn't make sense, maybe try gtk_text_view_scroll_to_mark() instead", G_STRLOC);
g_warning ("gtk_text_view_scroll_to_iter(): calling this function before showing the GtkTextView doesn't make sense, maybe try gtk_text_view_scroll_to_mark() instead");
return FALSE;
}
@ -1314,6 +1318,8 @@ gtk_text_view_scroll_to_iter (GtkTextView *text_view,
iter,
&rect);
DV (g_print (" target rect %d,%d %d x %d\n", rect.x, rect.y, rect.width, rect.height));
current_x_scroll = text_view->xoffset;
current_y_scroll = text_view->yoffset;
@ -1380,6 +1386,8 @@ gtk_text_view_scroll_to_iter (GtkTextView *text_view,
{
retval = set_adjustment_clamped (get_vadjustment (text_view),
current_y_scroll + scroll_inc);
DV (g_print (" vert increment %d\n", scroll_inc));
}
/* Horizontal scroll */
@ -1415,6 +1423,8 @@ gtk_text_view_scroll_to_iter (GtkTextView *text_view,
{
retval = set_adjustment_clamped (get_hadjustment (text_view),
current_x_scroll + scroll_inc);
DV (g_print (" horiz increment %d\n", scroll_inc));
}
if (retval)
@ -1473,9 +1483,8 @@ gtk_text_view_queue_scroll (GtkTextView *text_view,
static gboolean
gtk_text_view_flush_scroll (GtkTextView *text_view)
{
GtkTextIter iter, start, end;
GtkTextIter iter;
GtkTextPendingScroll *scroll;
gint y0, y1, height;
gboolean retval;
DV(g_print(G_STRLOC"\n"));
@ -1490,23 +1499,17 @@ gtk_text_view_flush_scroll (GtkTextView *text_view)
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, scroll->mark);
start = iter;
end = iter;
/* Force-validate the region around the iterator, at least the lines
* on either side, so that we can meaningfully get the iter location
/* Validate arbitrary area around the scroll destination, so the adjustment
* can meaningfully point into that area
*/
gtk_text_iter_backward_line (&start);
gtk_text_iter_forward_line (&end);
gtk_text_layout_get_line_yrange (text_view->layout, &start, &y0, NULL);
gtk_text_layout_get_line_yrange (text_view->layout, &end, &y1, &height);
DV(g_print (">Validating scroll destination ("G_STRLOC")\n"));
gtk_text_layout_validate_yrange (text_view->layout, &start, y0, y1 + height);
gtk_text_layout_validate_yrange (text_view->layout, &iter, -300, 300);
DV(g_print (">Done validating scroll destination ("G_STRLOC")\n"));
/* Ensure we have updated width/height */
gtk_text_view_update_adjustments (text_view);
retval = gtk_text_view_scroll_to_iter (text_view,
&iter,
scroll->within_margin,
@ -1524,7 +1527,7 @@ gtk_text_view_set_adjustment_upper (GtkAdjustment *adj, gdouble upper)
{
if (upper != adj->upper)
{
gdouble min = MAX (0., upper - adj->page_size);
gdouble min = MAX (0.0, upper - adj->page_size);
gboolean value_changed = FALSE;
adj->upper = upper;
@ -1540,7 +1543,7 @@ gtk_text_view_set_adjustment_upper (GtkAdjustment *adj, gdouble upper)
if (value_changed)
{
DV(g_print(">Changed adj value because upper descreased ("G_STRLOC")\n"));
DV(g_print(">Changed adj value because upper decreased ("G_STRLOC")\n"));
gtk_signal_emit_by_name (GTK_OBJECT (adj), "value_changed");
}
}
@ -3709,6 +3712,10 @@ cursor_blinks (GtkTextView *text_view)
GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
gboolean blink;
#ifdef DEBUG_VALIDATION_AND_SCROLLING
return FALSE;
#endif
g_object_get (G_OBJECT (settings), "gtk-cursor-blink", &blink, NULL);
return blink;
}
@ -3776,10 +3783,6 @@ gtk_text_view_stop_cursor_blink (GtkTextView *text_view)
static void
gtk_text_view_check_cursor_blink (GtkTextView *text_view)
{
#ifdef DEBUG_VALIDATION_AND_SCROLLING
return;
#endif
if (text_view->layout != NULL &&
text_view->cursor_visible &&
GTK_WIDGET_HAS_FOCUS (text_view))
@ -4001,6 +4004,7 @@ 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);

View File

@ -191,6 +191,9 @@ msgbox_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer data)
return FALSE;
}
/* Don't copy this example, it's all crack-smoking - you can just use
* GtkMessageDialog now
*/
gint
msgbox_run (GtkWindow *parent,
const char *message,
@ -842,6 +845,35 @@ do_example (gpointer callback_data,
view_add_example_widgets (new_view);
}
static void
do_insert_and_scroll (gpointer callback_data,
guint callback_action,
GtkWidget *widget)
{
View *view = view_from_widget (widget);
GtkTextBuffer *buffer;
GtkTextIter start, end;
GtkTextMark *mark;
buffer = view->buffer->buffer;
gtk_text_buffer_get_bounds (buffer, &start, &end);
mark = gtk_text_buffer_create_mark (buffer, NULL, &end, /* right grav */ FALSE);
gtk_text_iter_backward_char (&end);
gtk_text_buffer_insert (buffer, &end,
"Hello this is multiple lines of text\n"
"Line 1\n" "Line 2\n"
"Line 3\n" "Line 4\n"
"Line 5\n",
-1);
gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view->text_view), mark,
0, TRUE, 0.0, 1.0);
gtk_text_buffer_delete_mark (buffer, mark);
}
static void
do_wrap_changed (gpointer callback_data,
guint callback_action,
@ -1268,6 +1300,7 @@ static GtkItemFactoryEntry menu_items[] =
{ "/Attributes/Properties", NULL, do_properties, 0, NULL },
{ "/_Test", NULL, 0, 0, "<Branch>" },
{ "/Test/_Example", NULL, do_example, 0, NULL },
{ "/Test/_Insert and scroll", NULL, do_insert_and_scroll, 0, NULL },
};
static gboolean