[g-a-devel]impl_getBoundedRanges



While looking at implementing atk_text_get_bounded_ranges() I have studied 
impl_getBoundedRanges() and have, I think, idenfitied a number of errors.

Patch attached.

OK to commit?

Padraig
Index: text.c
===================================================================
RCS file: /cvs/gnome/at-spi/libspi/text.c,v
retrieving revision 1.19
diff -u -p -r1.19 text.c
--- text.c	10 Jan 2003 14:45:53 -0000	1.19
+++ text.c	14 Jan 2003 10:47:49 -0000
@@ -559,6 +559,7 @@ impl_getBoundedRanges(PortableServer_Ser
   int curr_offset;
   gint minLineStart, minLineEnd, maxLineStart, maxLineEnd;
   long bounds_min_offset;
+  long bounds_max_offset;
 
   clip.x = x;
   clip.y = y;
@@ -568,22 +569,24 @@ impl_getBoundedRanges(PortableServer_Ser
   /* for horizontal text layouts, at least, the following check helps. */
   bounds_min_offset =  atk_text_get_offset_at_point (text, x, y, 
 						     (AtkCoordType) coordType);
+  bounds_max_offset =  atk_text_get_offset_at_point (text, x + width, y + height, 
+						     (AtkCoordType) coordType);
   atk_text_get_text_at_offset (text, bounds_min_offset, 
 			       ATK_TEXT_BOUNDARY_LINE_START,
 			       &minLineStart, &minLineEnd);
-  atk_text_get_text_at_offset (text, bounds_min_offset, 
+  atk_text_get_text_at_offset (text, bounds_max_offset, 
 			       ATK_TEXT_BOUNDARY_LINE_START,
 			       &maxLineStart, &maxLineEnd);
-  startOffset = MIN (minLineStart, maxLineStart);
-  endOffset  = MIN (minLineEnd, maxLineEnd);
+  startOffset = MIN (minLineStart, minLineEnd);
+  endOffset  = MAX (maxLineStart, maxLineEnd);
 
   curr_offset = startOffset;
 
-  while (curr_offset < endOffset) 
+  while (curr_offset <= endOffset) 
     {
       int offset = startOffset;
       SpiTextRect cbounds;
-      while (curr_offset < endOffset) 
+      while (curr_offset <= endOffset) 
 	{
 	  atk_text_get_character_extents (text, curr_offset, 
 					  &cbounds.x, &cbounds.y, 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]