Problem in pango_layout_index_to_pos()



I've been trying to solve some bugs in the gtktextviewer widget, 
and I have stumbled upon a problem in pango.

The problem I'm looking at occurs in the following scenario:

    * Wrap is off
    * The line is longer than the "screen" (widget width) and thus
      a horizontal scrollbar is shown.
    * The insert mark is at the end of the line.
    * Control-E is pressed.

What happens then is that scrolling jumps to display the start of
the line instead of the end of the line. (The same behaviour occurs
if trying to type, the scrolling jumps back and forth between the
beginning and the end of the buffer.)

I eventually traced down the problem to the following lines in 
pango-layout.c:pango_layout_index_to_pos():

    if (notfound)
      {
	/* Iterator should now be on the "NULL" run at the end of the last
	 * line, which is a zero-width rectangle. Return the extents of
	 * that run.
	 */

	pango_layout_iter_get_run_extents (iter, NULL, pos);
      }

The problem is that pango_layout_iter_get_run_extents() does
not return a zero-width rectangle, but rather a rectangle of the 
complete row. Since the scrolling is done to the start of the rectangle
this causes the widget to be scrolled to the beginning of the line.

My question is what function should fullfill the creation of the zero-
width rectangle mentioned in the comment? pango_layout_index_to_pos()
or pango_layout_iter_get_run_extents()?

Regards,
Dov




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