gtk_text_buffer_place_cursor



Hi All,

Could someone please help?

I have an application (using gtk2.0 on win32) that uses a TextView window.
However, I want to force all text to be added
to the end of the buffer (like a terminal session). By using get_end_iter and
buffer_insert I was able to make sure that
any new text goes at the end of the buffer, but the user can leave the cursor
somewhere else and it looks weird. So I want
to move the cursor to the end of the buffer also. So I used

gtk_text_buffer_get_end_iter(view->buffer, &iter);
gtk_text_buffer_place_cursor (view->buffer, &iter);
gtk_text_buffer_insert_at_cursor (view->buffer, msg, len);

But I get lots of error messages from Pango.

<unknown> (pid:2248): ** CRITICAL **: file pango-layout.c: line 1707
(pango_layout_get_cursor_pos): assertion `index >= 0 && index <=
layout->length' failed

The message seems to suggest that the end iter is past the end of the buffer,
but how can that be?

Oh yes. The code does actually work, despite the huge volume of error messages.



--------------------------------------------------------------------
-- Philip J. Bunce, Software Consultant
-- MIPS Assembly, Embedded Systems, PMON, UNIX, & C
-- Ph: 831-659-5684 Fax: 501-325-6812 http://www.carmel.com
--------------------------------------------------------------------


...



Privacy