Commit 25b67af3 authored by Timm Bäder's avatar Timm Bäder 🤔
Browse files

textview: Ensure the borders fit into the allocation
parent 473e3462
......@@ -4003,7 +4003,10 @@ gtk_text_view_size_request (GtkWidget *widget,
border_width = gtk_container_get_border_width (GTK_CONTAINER (text_view));
requisition->width += border_width * 2;
requisition->height += border_width * 2;
requisition->height += priv->top_border + priv->bottom_border;
requisition->width += priv->left_border + priv->right_border;
tmp_list = priv->children;
while (tmp_list != NULL)
  • I believe the 'width' part of this commit is the cause of #628 (closed). requisition->width is first set to priv->layout->width, which already includes priv->left_border + priv->right_border. It's a bit labyrinthine, but essentially:

    • layout->width is set in update_layout_size() (gtktextlayout.c line 992) as the maximum line width, and
    • the line width is set to display->width in gtk_text_layout_real_wrap() (gtktextlayout.c line 1183), and
    • display->width is set to text_pixel_width + h_margin + h_padding in gtk_text_layout_get_line_display() (gtktextlayout.c line 2584), and
    • h_margin + h_padding is the same as priv->left_border + priv->right_border.

    Adding it again leads to an increase in the size-request, which results in wider lines; rinse and repeat.

  • mentioned in issue #628 (closed)

    Toggle commit list
  • mentioned in merge request !235 (closed)

    Toggle commit list
  • mentioned in merge request !236 (merged)

    Toggle commit list
  • mentioned in commit 4b4ae446

    Toggle commit list
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