Gtk2::S...::Buffer(3)

πŸ“¦
version 0.12 Β· 2 versions
, in fedora 43

πŸ’– 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::TextTagTable or undef)
  • 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 or undef)
  • boolean = $buffer->forward_iter_to_source_mark ($iter, $category) β€” and this one walks forward, twin energy πŸ‘―
    • $iter (Gtk2::TextIter)
    • $category (string or undef)
  • mark = $buffer->create_source_mark ($name, $category, $where) β€” new source mark, just dropped πŸ’–
    • $name (string or undef)
    • $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 or undef)
  • $buffer->get_source_marks_at_iter ($iter, $category) β€” what marks are chilling at this iter?
    • $iter (Gtk2::TextIter)
    • $category (string or undef)
  • $buffer->get_source_marks_at_line ($line, $category) β€” same question but for a whole line number
    • $line (integer)
    • $category (string or undef)

πŸ’€ 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 friend
  • boolean = $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 (or undef if you're going language-less, we support you)
    • $language (Gtk2::SourceView2::Language or undef)

⭐ 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 : default false : readable) β€” Whether Redo operation is possible
  • 'can-undo' (boolean : default false : readable) β€” Whether Undo operation is possible
  • 'highlight-matching-brackets' (boolean : default true : readable / writable) β€” Whether to highlight matching brackets
  • 'highlight-syntax' (boolean : default true : readable / writable) β€” Whether to highlight syntax in the buffer
  • 'language' (Gtk2::SourceView2::Language : default undef : readable / writable) β€” Language object to get highlighting patterns from
  • 'max-undo-levels' (integer : default 1000 : readable / writable) β€” Number of undo levels for the buffer
  • 'style-scheme' (Gtk2::SourceView2::StyleScheme : default undef : readable / writable) β€” Style scheme
  • 'undo-manager' (Glib::Object::_Unregistered::GtkSourceUndoManager : default undef : 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::SourceView2
  • Glib::Object
  • Gtk2::TextBuffer

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