summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/ugtk2.pm24
1 files changed, 12 insertions, 12 deletions
diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm
index 53b2eb81d..d7091b4ec 100644
--- a/perl-install/ugtk2.pm
+++ b/perl-install/ugtk2.pm
@@ -526,22 +526,22 @@ sub gtktext_append { gtktext_insert(@_, append => 1) }
sub gtktext_insert {
my ($textview, $t, %opts) = @_;
my $buffer = $textview->get_buffer;
+ $opts{append} or $buffer->set_text('', -1);
if (ref($t) eq 'ARRAY') {
- $opts{append} or $buffer->set_text('', -1);
- foreach my $token (@$t) {
- my ($iter1, $iter2);
- my $c = $buffer->get_char_count;
- $buffer->insert($iter1 = $buffer->get_end_iter, $token->[0], -1);
+ foreach my $token (@$t) {
+ my ($iter1, $iter2);
+ my $c = $buffer->get_char_count;
+ $buffer->insert($iter1 = $buffer->get_end_iter, $token->[0], -1);
$iter1->free;
- if ($token->[1]) {
- my $tag = $buffer->create_tag(undef);
- $tag->set(%{$token->[1]});
- $buffer->apply_tag($tag, $iter1 = $buffer->get_iter_at_offset($c), $iter2 = $buffer->get_end_iter);
+ if ($token->[1]) {
+ my $tag = $buffer->create_tag(undef);
+ $tag->set(%{$token->[1]});
+ $buffer->apply_tag($tag, $iter1 = $buffer->get_iter_at_offset($c), $iter2 = $buffer->get_end_iter);
$iter1->free; $iter2->free;
- }
- }
+ }
+ }
} else {
- $buffer->set_text($t, -1);
+ $buffer->set_text($t, -1);
}
#- the following line is needed to move the cursor to the beginning, so that if the
#- textview has a scrollbar, it won't scroll to the bottom when focusing (#3633)