Since we add one to the layout's reported width to account for the cursor,

Mon Aug 25 19:55:55 2003  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtktextview.c (gtk_text_view_update_layout_width):
        Since we add one to the layout's reported width to
        account for the cursor, we need to subtract one when
        setting the wrap width for the layout. (Fixes infinite
        loop (#120325, Federico Crozat)

        * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
        Be a bit more careful about rounding when converting
        wrapped width from Pango units to pixels.
This commit is contained in:
Owen Taylor
2003-08-26 00:06:18 +00:00
committed by Owen Taylor
parent 5e8c963498
commit 2be259b24a
7 changed files with 67 additions and 3 deletions

View File

@ -1,3 +1,15 @@
Mon Aug 25 19:55:55 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_update_layout_width):
Since we add one to the layout's reported width to
account for the cursor, we need to subtract one when
setting the wrap width for the layout. (Fixes infinite
loop (#120325, Federico Crozat)
* gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
Be a bit more careful about rounding when converting
wrapped width from Pango units to pixels.
2003-08-26 Matthias Clasen <maclas@gmx.de>
Rename GtkMenuMerge to GtkUIManager.

View File

@ -1,3 +1,15 @@
Mon Aug 25 19:55:55 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_update_layout_width):
Since we add one to the layout's reported width to
account for the cursor, we need to subtract one when
setting the wrap width for the layout. (Fixes infinite
loop (#120325, Federico Crozat)
* gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
Be a bit more careful about rounding when converting
wrapped width from Pango units to pixels.
2003-08-26 Matthias Clasen <maclas@gmx.de>
Rename GtkMenuMerge to GtkUIManager.

View File

@ -1,3 +1,15 @@
Mon Aug 25 19:55:55 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_update_layout_width):
Since we add one to the layout's reported width to
account for the cursor, we need to subtract one when
setting the wrap width for the layout. (Fixes infinite
loop (#120325, Federico Crozat)
* gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
Be a bit more careful about rounding when converting
wrapped width from Pango units to pixels.
2003-08-26 Matthias Clasen <maclas@gmx.de>
Rename GtkMenuMerge to GtkUIManager.

View File

@ -1,3 +1,15 @@
Mon Aug 25 19:55:55 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_update_layout_width):
Since we add one to the layout's reported width to
account for the cursor, we need to subtract one when
setting the wrap width for the layout. (Fixes infinite
loop (#120325, Federico Crozat)
* gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
Be a bit more careful about rounding when converting
wrapped width from Pango units to pixels.
2003-08-26 Matthias Clasen <maclas@gmx.de>
Rename GtkMenuMerge to GtkUIManager.

View File

@ -1,3 +1,15 @@
Mon Aug 25 19:55:55 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (gtk_text_view_update_layout_width):
Since we add one to the layout's reported width to
account for the cursor, we need to subtract one when
setting the wrap width for the layout. (Fixes infinite
loop (#120325, Federico Crozat)
* gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
Be a bit more careful about rounding when converting
wrapped width from Pango units to pixels.
2003-08-26 Matthias Clasen <maclas@gmx.de>
Rename GtkMenuMerge to GtkUIManager.

View File

@ -122,6 +122,8 @@ enum {
LAST_ARG
};
#define PIXEL_BOUND(d) (((d) + PANGO_SCALE - 1) / PANGO_SCALE)
static void gtk_text_layout_init (GtkTextLayout *text_layout);
static void gtk_text_layout_class_init (GtkTextLayoutClass *klass);
static void gtk_text_layout_finalize (GObject *object);
@ -1972,7 +1974,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
pango_layout_get_extents (display->layout, NULL, &extents);
display->width = PANGO_PIXELS (extents.width) + display->left_margin + display->right_margin;
display->width = PIXEL_BOUND (extents.width) + display->left_margin + display->right_margin;
display->height += PANGO_PIXELS (extents.height);
/* Free this if we aren't in a loop */

View File

@ -94,6 +94,8 @@
#define SCREEN_WIDTH(widget) text_window_get_width (GTK_TEXT_VIEW (widget)->text_window)
#define SCREEN_HEIGHT(widget) text_window_get_height (GTK_TEXT_VIEW (widget)->text_window)
#define SPACE_FOR_CURSOR 1
struct _GtkTextPendingScroll
{
GtkTextMark *mark;
@ -1702,7 +1704,7 @@ gtk_text_view_update_adjustments (GtkTextView *text_view)
gtk_text_layout_get_size (text_view->layout, &width, &height);
/* Make room for the cursor after the last character in the widest line */
width++;
width += SPACE_FOR_CURSOR;
if (text_view->width != width || text_view->height != height)
{
@ -1742,7 +1744,7 @@ gtk_text_view_update_layout_width (GtkTextView *text_view)
gtk_text_view_ensure_layout (text_view);
gtk_text_layout_set_screen_width (text_view->layout,
SCREEN_WIDTH (text_view));
MAX (1, SCREEN_WIDTH (text_view) - SPACE_FOR_CURSOR));
}
static void