Gtk2::Ex::TextView::FollowAppend -- variant of TextView following appended text


 use Gtk2::Ex::TextView::FollowAppend;
 my $textview = Gtk2::Ex::TextView::FollowAppend->new;


Gtk2::Ex::TextView::FollowAppend is a subclass of Gtk2::TextView.



This is slightly experimental and might move to a different dist.

TextView::FollowAppend arranges to automatically scroll to follow text appended in the underlying TextBuffer. The effect is like Emacs compilation-scroll-output and is good for following text progressively added by a background task or subprocess, but still allowing the user to scroll back to see earlier output.

A scroll is done when the insertion point cursor is at the end of the buffer and the buffer end is visible. Any text, pixbuf or child insertion, or child resize or window resize then gets a scroll to keep the end still visible.


This is implemented as a subclass of TextView since that seems the easiest way to catch a size-allocate before the new size has been applied, so as to see whether the cursor-at-end plus end-visible conditions are met and thus end-visible should be forced on the new size. Because size-allocate is a run-first signal an external signal connection only runs once the new size is applied. Maybe it'd be possible to track end-visible all the time though, ready for a window resize or contents resize.


$textview = Gtk2::Ex::TextView::FollowAppend->new (key=>value,...)

Create and return a new TextView::FollowAppend object. Optional key/value pairs set initial properties as per Glib::Object->new.

    $textview = Gtk2::Ex::TextView::FollowAppend->new;
$textview = Gtk2::Ex::TextView::FollowAppend->new_with_buffer ($textbuf)

Create and return a new TextView::FollowAppend with an initial TextBuffer. This is as per Gtk2::TextView->new_with_buffer, but creating a TextView::FollowAppend. It's the same as

    $textview = Gtk2::Ex::TextView::FollowAppend->new (buffer => $textbuf);


Gtk2::TextView, Gtk2::TextBuffer



Gtk2-Ex-ErrorTextDialog is Copyright 2007, 2008, 2009, 2010, 2011, 2013 Kevin Ryde

Gtk2-Ex-ErrorTextDialog is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Gtk2-Ex-ErrorTextDialog is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Gtk2-Ex-ErrorTextDialog. If not, see