textlayout, toolitemgroup, treeview: drop counts nothing reads

In totally_invisible_line() the count was the first branch of the
toggle tests; toggles have no bytes, so they are tested on their own.
This commit is contained in:
Daemonratte 2026-10-19 14:09:22 +02:00
commit ffd1f32d7a
3 changed files with 4 additions and 18 deletions

View file

@ -1476,7 +1476,6 @@ totally_invisible_line (GtkTextLayout *layout,
GtkTextIter *iter)
{
GtkTextLineSegment *seg;
int bytes = 0;
/* Check if the first char is visible, if so we are partially visible.
* Note that we have to check this since we don't know the current
@ -1489,22 +1488,18 @@ totally_invisible_line (GtkTextLayout *layout,
if (!_gtk_text_btree_char_is_invisible (iter))
return FALSE;
bytes = 0;
seg = line->segments;
while (seg != NULL)
{
if (seg->byte_count > 0)
bytes += seg->byte_count;
/* Note that these two tests can cause us to bail out
* when we shouldn't, because a higher-priority tag
* may override these settings. However the important
* thing is to only invisible really-invisible lines, rather
* than to invisible all really-invisible lines.
* (Toggles are the segments without bytes.)
*/
else if (seg->type == &gtk_text_toggle_on_type)
if (seg->type == &gtk_text_toggle_on_type)
{
invalidate_cached_style (layout);
@ -2375,7 +2370,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
gchar *text;
gint text_pixel_width;
PangoAttrList *attrs;
gint text_allocated, layout_byte_offset, buffer_byte_offset;
gint text_allocated, layout_byte_offset;
PangoRectangle extents;
gboolean para_values_set = FALSE;
GSList *cursor_byte_offsets = NULL;
@ -2455,7 +2450,6 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
/* Iterate over segments, creating display chunks for them, and updating the tags array. */
layout_byte_offset = 0; /* current length of layout text (includes preedit, does not include invisible text) */
buffer_byte_offset = 0; /* position in the buffer line */
seg = _gtk_text_iter_get_any_segment (&iter);
tags = get_tags_array_at_iter (&iter);
initial_toggle_segments = TRUE;
@ -2505,7 +2499,6 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
{
memcpy (text + layout_byte_offset, seg->body.chars, seg->byte_count);
layout_byte_offset += seg->byte_count;
buffer_byte_offset += seg->byte_count;
bytes += seg->byte_count;
}
else if (seg->type == &gtk_text_right_mark_type ||
@ -2556,7 +2549,6 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
memcpy (text + layout_byte_offset, gtk_text_unknown_char_utf8,
seg->byte_count);
layout_byte_offset += seg->byte_count;
buffer_byte_offset += seg->byte_count;
}
else if (seg->type == &gtk_text_child_type)
{
@ -2571,7 +2563,6 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
memcpy (text + layout_byte_offset, gtk_text_unknown_char_utf8,
seg->byte_count);
layout_byte_offset += seg->byte_count;
buffer_byte_offset += seg->byte_count;
}
else
{
@ -2583,7 +2574,6 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
else
{
/* Invisible segment */
buffer_byte_offset += seg->byte_count;
}
release_style (layout, style);

View file

@ -949,7 +949,7 @@ gtk_tool_item_group_real_size_allocate (GtkWidget *widget,
/* when expanded or in transition, place the tool items in a grid like layout */
if (!priv->collapsed || !priv->animation || priv->animation_timeout)
{
gint col = 0, row = 0;
gint col = 0;
for (it = priv->children; it != NULL; it = it->next)
{
@ -975,7 +975,6 @@ gtk_tool_item_group_real_size_allocate (GtkWidget *widget,
/* select next row if at end of row */
if (col > 0 && (child->new_row || (col * item_size.width) + MAX (child_requisition.width, item_size.width) > item_area.width))
{
row++;
col = 0;
child_allocation.y += child_allocation.height;
}

View file

@ -6306,7 +6306,6 @@ do_validate_rows (GtkTreeView *tree_view, gboolean queue_resize)
GtkTreePath *path = NULL;
GtkTreeIter iter;
GTimer *timer;
gint i = 0;
gint prev_height = -1;
gboolean fixed_height = TRUE;
@ -6401,8 +6400,6 @@ do_validate_rows (GtkTreeView *tree_view, gboolean queue_resize)
else if (prev_height != height)
fixed_height = FALSE;
}
i++;
}
while (g_timer_elapsed (timer, NULL) < GTK_TREE_VIEW_TIME_MS_PER_IDLE / 1000.);