The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Gtk2::Ex::TextBufferBits -- helpers for Gtk2::TextBuffer objects

SYNOPSIS

 use Gtk2::Ex::TextBufferBits;

FUNCTIONS

Gtk2::Ex::TextBufferBits::replace_lines ($textbuf, $str)

Replace the text in $textbuf with $str, line by line. This is the same as $textbuf->set_text($str), but preserves marks.

Marks within a line move to the start if they're left-gravity, or the end if right-gravity. Marks at the very end of the buffer stay at the new end. If there's no newline on the last line then right-gravity marks anywhere in it end up at the new end too.

The insert and selection marks have their column positions preserved too. The intention would be to do that for all marks, but as of Gtk 2.20 there's no fast way to get them all.

Gtk2::TextView keeps its window position as a mark at the start of a line. replace_lines preserves that, which means the TextView shows the same lines of the buffer whereas a plain $textbuf->set_text($str) makes it jump to the start of the buffer.

SEE ALSO

Gtk2::TextBuffer, Gtk2::Ex::WidgetBits

HOME PAGE

http://user42.tuxfamily.org/gtk2-ex-widgetbits/index.html

LICENSE

Copyright 2010, 2011, 2012 Kevin Ryde

Gtk2-Ex-WidgetBits 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-WidgetBits 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-WidgetBits. If not, see http://www.gnu.org/licenses/.