Gtk2::S...::Buffer(3)
π Gtk2::SourceView2::Buffer β the manual page bestie π
okay so you're looking at the Gtk2::S...::Buffer(3) page, from the User Contributed Perl Documentation β¨ (the terminal truncates the name like that but bestie it's fully Gtk2::SourceView2::Buffer, iykyk). Sit down, grab a strawberry π, and let's get into it.
πΈ NAME πΈ
Gtk2::SourceView2::Buffer β the buffer where all your source-code glow-up happens π
π¦ HIERARCHY π¦
it's giving ancestry.com fr fr, look at this lineage:
Glib::Object
+----Gtk2::TextBuffer
+----Gtk2::SourceView2::Buffer
so it inherits from Gtk2::TextBuffer, which inherits from Glib::Object. three generations of iconic behavior π
β¨ METHODS β¨
π Constructors, the main character entries
buffer = Gtk2::SourceView2::Buffer->new ($table)β makes you a fresh new buffer, no cap π«Ά$table(Gtk2::TextTagTableorundef)
buffer = Gtk2::SourceView2::Buffer->new_with_language ($language)β same vibe but you hand it a language from the jump π$language(Gtk2::SourceView2::Language)
π₯ Source marks, iterating around
boolean = $buffer->backward_iter_to_source_mark ($iter, $category)β walk backwards from the iter to a source mark, literally$iter(Gtk2::TextIter)$category(string orundef)
boolean = $buffer->forward_iter_to_source_mark ($iter, $category)β and this one walks forward, twin energy π―$iter(Gtk2::TextIter)$category(string orundef)
mark = $buffer->create_source_mark ($name, $category, $where)β new source mark, just dropped π$name(string orundef)$category(string)$where(Gtk2::TextIter)
$buffer->remove_source_marks ($start, $end, $category)β bye bye marks in that range, not me being the cleaner π§Ή$start(Gtk2::TextIter)$end(Gtk2::TextIter)$category(string orundef)
$buffer->get_source_marks_at_iter ($iter, $category)β what marks are chilling at this iter?$iter(Gtk2::TextIter)$category(string orundef)
$buffer->get_source_marks_at_line ($line, $category)β same question but for a whole line number$line(integer)$category(string orundef)
π Undo / redo, the time travel section
$buffer->begin_not_undoable_actionβ start a chunk of stuff you refuse to let anyone undo πboolean = $buffer->can_redoβ can we redo tho? asking for a friendboolean = $buffer->can_undoβ and can we undo? also asking$buffer->end_not_undoable_actionβ close that not-undoable chunk, periodt$buffer->redoβ redo it, slay β¨$buffer->undoβ undo it, take it back π
π§ Highlighting & vibes
$buffer->ensure_highlight ($start, $end)β make sure the highlighting is applied across that range, no gaps bestie$start(Gtk2::TextIter)$end(Gtk2::TextIter)
boolean = $buffer->get_highlight_matching_bracketsβ is bracket matching turned on rn?$buffer->set_highlight_matching_brackets ($highlight)β turn bracket matching on or off, your call π$highlight(boolean)
boolean = $buffer->get_highlight_syntaxβ syntax highlighting status check π$buffer->set_highlight_syntax ($highlight)β flip syntax highlighting$highlight(boolean)
π Language, the ~aesthetic~ of your code
language or undef = $buffer->get_languageβ which language is this buffer serving?$buffer->set_language ($language)β assign it one (orundefif you're going language-less, we support you)$language(Gtk2::SourceView2::Languageorundef)
β Undo levels & style scheme
integer = $buffer->get_max_undo_levelsβ how deep does the undo rabbit hole go?$buffer->set_max_undo_levels ($max_undo_levels)β set that depth fr fr$max_undo_levels(integer)
stylescheme or undef = $buffer->get_style_schemeβ which style scheme is currently the fit? π$buffer->set_style_scheme ($scheme)β put a new scheme on, main character energy$scheme(Gtk2::SourceView2::StyleScheme)
π PROPERTIES π
'can-redo'(boolean : defaultfalse: readable) β Whether Redo operation is possible'can-undo'(boolean : defaultfalse: readable) β Whether Undo operation is possible'highlight-matching-brackets'(boolean : defaulttrue: readable / writable) β Whether to highlight matching brackets'highlight-syntax'(boolean : defaulttrue: readable / writable) β Whether to highlight syntax in the buffer'language'(Gtk2::SourceView2::Language: defaultundef: readable / writable) β Language object to get highlighting patterns from'max-undo-levels'(integer : default1000: readable / writable) β Number of undo levels for the buffer'style-scheme'(Gtk2::SourceView2::StyleScheme: defaultundef: readable / writable) β Style scheme'undo-manager'(Glib::Object::_Unregistered::GtkSourceUndoManager: defaultundef: readable / writable / construct) β The buffer undo manager
π«Ά SIGNALS π«Ά
these fire off and you better be listening bestie:
bracket-matched(Gtk2::SourceView2::Buffer,Gtk2::TextIter,GtkSourceBracketMatchType)highlight-updated(Gtk2::SourceView2::Buffer,Gtk2::TextIter,Gtk2::TextIter)redo(Gtk2::SourceView2::Buffer)source-mark-updated(Gtk2::SourceView2::Buffer,Gtk2::TextMark)undo(Gtk2::SourceView2::Buffer)
π ENUMS AND FLAGS π
πΈ enum GtkSourceBracketMatchType
'none'/GTK_SOURCE_BRACKET_MATCH_NONE'out-of-range'/GTK_SOURCE_BRACKET_MATCH_OUT_OF_RANGE'not-found'/GTK_SOURCE_BRACKET_MATCH_NOT_FOUND'found'/GTK_SOURCE_BRACKET_MATCH_FOUND
π SEE ALSO π
go read these next, they're the friend group:
Gtk2::SourceView2Glib::ObjectGtk2::TextBuffer
π COPYRIGHT π
Copyright (C) 2009 by Emmanuel Rodriguez
π that's the whole page bestie, you ate it. go forth and highlight some syntax. periodt. π
mwah π β this was Gtk2::S...::Buffer(3) from perl v5.42.0, dated 2025-07-25. ty for reading, ily, bye π¦
π¦ where this page comes from
- fedora 43: perl-Gtk2-SourceView2 0.12-18.fc43 Β· GPL-2.0-or-later OR Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms