Scrolling to bottom of TextView?



Dear all,

currently I'm using the following code to insert some lines at the end of a TextView/TextBuffer (contained in a ScrolledWindow) and scroll to the bottom:

    my $buf = $gscript_textview->get_buffer;

    $buf->place_cursor($buf->get_end_iter);
    for (@_) {
        $buf->insert_at_cursor($_ . "\n");
    }

    $buf->place_cursor($buf->get_end_iter);
    my $mark = $buf->create_mark(undef, $buf->get_end_iter, 0);
    $gscript_textview->scroll_mark_onscreen($mark);
    $buf->delete_mark($mark);

This uses an otherwise superfluous mark for the scrolling.
Is this the canonical way or is there an easier way to achieve this (without the mark)?

Martin



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