Gtk2::Ex::TextBufferBits -- helpers for Gtk2::TextBuffer objects
Gtk2::Ex::TextBufferBits::replace_lines ($textbuf, $str)
Replace the text in
$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::TextViewkeeps its window position as a mark at the start of a line.
replace_linespreserves 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.
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/.