Re: [Bug 60630] Changed - Cursor position not always displayed in GtkTextView
- From: Owen Taylor <otaylor redhat com>
- To: "Padraig O'Briain" <Padraig Obriain Sun COM>
- Cc: hp redhat com, gtk-devel-list gnome org
- Subject: Re: [Bug 60630] Changed - Cursor position not always displayed in GtkTextView
- Date: 24 Sep 2001 18:37:27 -0400
"Padraig O'Briain" <Padraig Obriain Sun COM> writes:
> It seems that the only place that pango_layout_index_to_pos() is called is in
> gtk_text_layout_get_iter_location() so I propose the change below.
I've committed something more or like this now.
> if (!pango_layout_iter_next_line (iter))
> {
> - notfound = TRUE;
> + /*
> + * Iterator should now be on the "NULL" run at the end of the last
> + * line or the end of any line if no wrapping is in effect.
> + */
This comment is just wrong (and was at the previous location as well),
so I removed it.
> - else
> - {
> - int x_pos;
> + pos->y = logical_rect.y;
> + pos->height = logical_rect.height;
>
> - pos->y = logical_rect.y;
> - pos->height = logical_rect.height;
> + pango_layout_line_index_to_x (layout_line, index, 0, &x_pos);
> + pos->x = logical_rect.x + x_pos;
>
> - pango_layout_line_index_to_x (layout_line, index, 0, &x_pos);
> - pos->x = logical_rect.x + x_pos;
> -
> - pango_layout_line_index_to_x (layout_line, index, 1, &x_pos);
> - pos->width = (logical_rect.x + x_pos) - pos->x;
> - }
> + pango_layout_line_index_to_x (layout_line, index, 1, &x_pos);
> + pos->width = (logical_rect.x + x_pos) - pos->x;
It is somewhat undefined to passing trailing = 1 for the last position
in the line, though it would work currently. Instead of doing this,
I wrote:
if (index < layout_line->length)
{
pango_layout_line_index_to_x (layout_line, index, 1, &x_pos);
pos->width = (logical_rect.x + x_pos) - pos->x;
}
else
pos->width = 0;
Thanks for tracking this bug down,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]