]> Pileus Git - ~andy/gtk/commitdiff
Make sure the mark we pass to line start is the beginning of a real line,
authorOwen Taylor <otaylor@redhat.com>
Tue, 25 Aug 1998 22:22:12 +0000 (22:22 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Tue, 25 Aug 1998 22:22:12 +0000 (22:22 +0000)
Tue Aug 25 16:52:47 1998  Owen Taylor  <otaylor@redhat.com>

* gtk/gtktext.c (recompute_geometry): Make sure the
mark we pass to line start is the beginning of a
real line, not a wrapped one.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktext.c

index 65f98ce78e4b3b8252a32954559cfad59e840018..4f4172b46864904f27faed49d96a00fecb874cac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Aug 25 16:52:47 1998  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktext.c (recompute_geometry): Make sure the
+       mark we pass to line start is the beginning of a 
+       real line, not a wrapped one.
+
 Mon Aug 24 18:37:15 1998  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktext.c: Reference count the fonts used in
index 65f98ce78e4b3b8252a32954559cfad59e840018..4f4172b46864904f27faed49d96a00fecb874cac 100644 (file)
@@ -1,3 +1,9 @@
+Tue Aug 25 16:52:47 1998  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktext.c (recompute_geometry): Make sure the
+       mark we pass to line start is the beginning of a 
+       real line, not a wrapped one.
+
 Mon Aug 24 18:37:15 1998  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktext.c: Reference count the fonts used in
index 65f98ce78e4b3b8252a32954559cfad59e840018..4f4172b46864904f27faed49d96a00fecb874cac 100644 (file)
@@ -1,3 +1,9 @@
+Tue Aug 25 16:52:47 1998  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktext.c (recompute_geometry): Make sure the
+       mark we pass to line start is the beginning of a 
+       real line, not a wrapped one.
+
 Mon Aug 24 18:37:15 1998  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktext.c: Reference count the fonts used in
index 65f98ce78e4b3b8252a32954559cfad59e840018..4f4172b46864904f27faed49d96a00fecb874cac 100644 (file)
@@ -1,3 +1,9 @@
+Tue Aug 25 16:52:47 1998  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktext.c (recompute_geometry): Make sure the
+       mark we pass to line start is the beginning of a 
+       real line, not a wrapped one.
+
 Mon Aug 24 18:37:15 1998  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktext.c: Reference count the fonts used in
index 65f98ce78e4b3b8252a32954559cfad59e840018..4f4172b46864904f27faed49d96a00fecb874cac 100644 (file)
@@ -1,3 +1,9 @@
+Tue Aug 25 16:52:47 1998  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktext.c (recompute_geometry): Make sure the
+       mark we pass to line start is the beginning of a 
+       real line, not a wrapped one.
+
 Mon Aug 24 18:37:15 1998  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktext.c: Reference count the fonts used in
index 65f98ce78e4b3b8252a32954559cfad59e840018..4f4172b46864904f27faed49d96a00fecb874cac 100644 (file)
@@ -1,3 +1,9 @@
+Tue Aug 25 16:52:47 1998  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktext.c (recompute_geometry): Make sure the
+       mark we pass to line start is the beginning of a 
+       real line, not a wrapped one.
+
 Mon Aug 24 18:37:15 1998  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktext.c: Reference count the fonts used in
index 65f98ce78e4b3b8252a32954559cfad59e840018..4f4172b46864904f27faed49d96a00fecb874cac 100644 (file)
@@ -1,3 +1,9 @@
+Tue Aug 25 16:52:47 1998  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktext.c (recompute_geometry): Make sure the
+       mark we pass to line start is the beginning of a 
+       real line, not a wrapped one.
+
 Mon Aug 24 18:37:15 1998  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtktext.c: Reference count the fonts used in
index ba0c1e697de798e7f0625d35fafa499d82434beb..aa67e407ea62ae36a0320f23434083c2e31a7b68 100644 (file)
@@ -5087,21 +5087,36 @@ gtk_text_update_text    (GtkEditable       *editable,
 static void
 recompute_geometry (GtkText* text)
 {
-  GtkPropertyMark start_mark;
+  GtkPropertyMark mark, start_mark;
+  GList *new_lines;
   gint height;
   gint width;
   
   free_cache (text);
   
-  start_mark = set_vertical_scroll (text);
-  
+  mark = start_mark = set_vertical_scroll (text);
+
+  /* We need a real start of a line when calling fetch_lines().
+   * not the start of a wrapped line.
+   */
+  while (mark.index > 0 &&
+        GTK_TEXT_INDEX (text, mark.index - 1) != LINE_DELIM)
+    decrement_mark (&mark);
+
   gdk_window_get_size (text->text_area, &width, &height);
   
-  text->line_start_cache = fetch_lines (text,
-                                       &start_mark,
-                                       NULL,
-                                       FetchLinesPixels,
-                                       height + text->first_cut_pixels);
+  new_lines = fetch_lines (text,
+                          &mark,
+                          NULL,
+                          FetchLinesPixels,
+                          height + text->first_cut_pixels);
+
+  /* Now work forward to the actual first onscreen line */
+
+  while (CACHE_DATA (new_lines).start.index < start_mark.index)
+    new_lines = new_lines->next;
+  
+  text->line_start_cache = new_lines;
   
   find_cursor (text, TRUE);
 }