com gtk/php-gtk: Bugs related to GtkTextBuffer and GtkTextTagTable.: test/bug_gtktextbuffer_move_mark_by_name_selection _bound.php test/bug_gtktexttagtable_lookup_foreach .php
[email protected] (David Soria Parra) Tue, 11 Oct 2005 00:52:40 +0000
| Newsgroups | php.gtk.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 97fdd7356783ec34f1ca2862e9a0ef1ba0ebc5b7=0AAuthor: Scott Matt= ocks <[email protected]> Tue, 11 Oct 2005 00:52:40 +0000=0APare= nts: 3ee388ff47a10c0e9547c92a43cca7025b38a3ff=0ABranches: master=0A=0ALi= nk: http://git.php.net/?p=3Dgtk/php-gtk.git;a=3Dcommitdiff;h=3D97fdd7= 356783ec34f1ca2862e9a0ef1ba0ebc5b7=0A=0ALog:=0ABugs related to GtkTextBuffe= r and GtkTextTagTable.=0A=0AChanged paths:=0A A test/bug_gtktextbuffer_mo= ve_mark_by_name_selection_bound.php=0A A test/bug_gtktexttagtable_lookup_= foreach.php=0A=0A=0ADiff:=0A97fdd7356783ec34f1ca2862e9a0ef1ba0ebc5b7=0Adiff= --git a/test/bug_gtktextbuffer_move_mark_by_name_selection_bound.php b/tes= t/bug_gtktextbuffer_move_mark_by_name_selection_bound.php=0Anew file mode 1= 00644=0Aindex 0000000..fa107c5=0A--- /dev/null=0A+++ b/test/bug_gtktextbuff= er_move_mark_by_name_selection_bound.php=0A@@ -0,0 +1,55 @@=0A+<?php=0A+fun= ction printSelected($buffer, $iter, $mark)=0A+{=0A+=09// Get the mark that = wasn't moved. =0A+=09if ($mark =3D=3D $buffer->get_mark('insert')) {=0A+=09= =09$mark2 =3D $buffer->get_mark('selection_bound');=0A+=09} else {=0A+=09= =09$mark2 =3D $buffer->get_mark('insert');=0A+=09}=0A+=09// Get the iter at= the other mark.=0A+=09$iter2 =3D $buffer->get_iter_at_offset(0);=0A+=09$bu= ffer->get_iter_at_mark($iter2, $mark2);=0A+=0A+=09echo 'Iter1: ' . $iter->g= et_offset() . "\t";=0A+=09echo 'Iter2: ' . $iter2->get_offset() . "\t";=0A= +=0A+=09// Print the text between the two iters.=0A+=09echo 'SELECTION: ' .= $buffer->get_text($iter, $iter2) . "\n";=0A+}=0A+=0A+// Create a GtkTextVi= ew.=0A+$text =3D new GtkTextView();=0A+// Get the buffer from the view.=0A+= $buffer =3D $text->get_buffer();=0A+=0A+// Add some text.=0A+$buffer->set_t= ext('Moving a mark is done with either move_mark or move_mark_by_name.');= =0A+=0A+// Connect the printSelected method.=0A+$buffer->connect('mark-set'= , 'printSelected');=0A+=0A+// How NOT to move the cursor to the beginning o= f the text.=0A+echo "Move to start\n";=0A+$buffer->move_mark_by_name('inser= t', $buffer->get_start_iter());=0A+$buffer->move_mark_by_name('sel= ection_bound', $buffer->get_start_iter());=0A+=0A+// How NOT to select a ra= nge of text.=0A+echo "Select range\n";=0A+$buffer->move_mark_by_name('selec= tion_bound', $buffer->get_iter_at_offset(7));=0A+$buffer->move_mark_by_name= ('insert', $buffer->get_iter_at_offset(16));=0A+=0A+// The better = way to move the cursor to the beginning of the text.=0A+echo "Move to start= \n";=0A+$buffer->place_cursor($buffer->get_start_iter());=0A+=0A+// The bet= ter way to select a range of text.=0A+echo "Select range\n";=0A+$buffer->se= lect_range($buffer->get_iter_at_offset(7), $buffer->get_iter_at_offset(16))= ;=0A+/*=0A+ * Local variables:=0A+ * tab-width: 4=0A+ * c-basic-offset: 4= =0A+ * End:=0A+ */=0A+?>=0A\ No newline at end of file=0Adiff --git a/test/= bug_gtktexttagtable_lookup_foreach.php b/test/bug_gtktexttagtable_lookup_fo= reach.php=0Anew file mode 100644=0Aindex 0000000..d7b7e4c=0A--- /dev/null= =0A+++ b/test/bug_gtktexttagtable_lookup_foreach.php=0A@@ -0,0 +1,15 @@=0A+= <?php=0A+function varDumpTag($tag)=0A+{=0A+ var_dump($tag);=0A+}=0A+=0A+$v= iew =3D new GtkTextView();=0A+$buffer =3D $view->get_buffer();=0A+$= textTable =3D $buffer->get_tag_table();=0A+=0A+$tag =3D new GtkTextTag('Bob= ');=0A+$textTable->add($tag);=0A+$textTable->lookup('Bob');=0A+$textTable->= foreach('varDumpTag');=0A+?>=0A\ No newline at end of file=0A