summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2003-08-26 00:06:09 +0000
committerOwen Taylor <otaylor@src.gnome.org>2003-08-26 00:06:09 +0000
commite86529966ab4e3989735c4181470109a590853fa (patch)
tree7cae4b3824fdf8af7638bbb278d0ca014b29f3e8
parent4b01f3de88855fa8d8d8b8a9f5f1512653253a48 (diff)
downloadgdk-pixbuf-e86529966ab4e3989735c4181470109a590853fa.tar.gz
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.
-rw-r--r--ChangeLog12
-rw-r--r--ChangeLog.pre-2-1012
-rw-r--r--ChangeLog.pre-2-412
-rw-r--r--ChangeLog.pre-2-612
-rw-r--r--ChangeLog.pre-2-812
-rw-r--r--gtk/gtktextlayout.c4
-rw-r--r--gtk/gtktextview.c6
7 files changed, 67 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 604ecb67f..df2ab29fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
+
Mon Aug 25 17:28:04 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_forall): Don't
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 604ecb67f..df2ab29fd 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -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.
+
Mon Aug 25 17:28:04 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_forall): Don't
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 604ecb67f..df2ab29fd 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -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.
+
Mon Aug 25 17:28:04 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_forall): Don't
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 604ecb67f..df2ab29fd 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -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.
+
Mon Aug 25 17:28:04 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_forall): Don't
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 604ecb67f..df2ab29fd 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -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.
+
Mon Aug 25 17:28:04 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_forall): Don't
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index 17f28c334..d3e33785b 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -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);
@@ -1975,7 +1977,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 */
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index f6a698595..5aa129c29 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -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;
@@ -1691,7 +1693,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)
{
@@ -1731,7 +1733,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