gtksourceview2.Buffer — Text buffer object for gtksourceview2.View
| class gtksourceview2.Buffer(gtk.TextBuffer): | 
Functionsdef gtksourceview2.iter_backward_search(iter,str,flags,limit)def gtksourceview2.iter_forward_search(iter,str,flags,limit)
| 
 | 
|     def callback( | |
| "source-mark-updated" |     def callback( | 
The gtksourceview2.Buffer
is the model for gtksourceview.View
widgets. It extends the gtk.TextBuffer
object by adding features necessary to display and edit source code: syntax highlighting, bracket matching and markers. 
It also implements support for undo/redo operations.
To create a gtksourceview2.Buffer 
use the constructor.
By default highlighting is enabled, but you can disable it with 
set_highlight_syntax().
    gtksourceview2.Buffer(table=None, language=None)| 
 | a gtk.TextTagTableorNone | 
| 
 | a gtksourceview2.LanguageorNone | 
| Returns : | a new gtksourceview2.Buffer. | 
    Creates a new gtksourceview2.Buffer object.
  
    def backward_iter_to_source_mark(iter, category=None)| 
 | a gtk.TextIter | 
| 
 | category to search for or None. | 
| Returns : | whether iter moved. | 
      The backward_iter_to_source_mark() method moves iter to the
      position of the previous gtksourceview2.Mark
      of the given category. Returns True if iter was moved.
      If category is None, the previous source mark can be of any category.
    
    def begin_not_undoable_action()
      The begin_not_undoable_action() marks the beginning of a not undoable action on the buffer, 
      disabling the undo manager. Typically you would call this function before initially setting the contents of the buffer 
      (e.g. when loading a file in a text editor).
    
      You may nest begin_not_undoable_action() / 
      end_not_undoable_action() blocks.
    
    def can_redo()| Returns : | Trueif a redo is possible. | 
      The can_redo() method Determines whether a source buffer can redo the last action 
      (i.e. if the last operation was an undo).
    
    def can_undo()| Returns : | Trueif it's possible to undo the last action. | 
      The can_undo() method determines whether a source buffer can undo the last action.
    
    def create_source_mark(name, category, where)| 
 | the name of the mark, or None. | 
| 
 | a string defining the mark category. | 
| 
 | location to place the mark. | 
| Returns : | a new gtksourceview2.Mark | 
      The create_source_mark() method creates a mark in the 
      gtksourceview2.Buffer of category 
      category. A mark is semantically very similar to a 
      gtk.TextMark, but organised into categories.
    
     Like a gtk.TextMark, a
     gtksourceview2.Mark
     can be anonymous if the passed name is None.
    
      Like a gtk.TextMark, a 
      gtksourceview2.Marker
      can be anonymous if the passed name is None. 
      Also, the buffer owns the markers so you shouldn't unreference it.
    
Marks always have left gravity and are moved to the beginning of the line when the user deletes the line they were in. Also, if the user deletes a region of text which contained lines with markers, those are deleted.
Typical uses for marks are bookmarks, breakpoints, current executing instruction indication in a source file, etc..
    def end_not_undoable_action()
      The end_not_undoable_action() method marks the end of a not undoable action on the buffer. 
      When the last not undoable block is closed through the call to this function, the list of undo actions is cleared 
      and the undo manager is re-enabled.
    
    def ensure_highlight(start, end)| 
 | start of the area to highlight. | 
| 
 | end of the area to highlight. | 
      The ensure_highlight() method forces buffer to analyze
      and highlight the given area synchronously.
    
    def forward_iter_to_source_mark(iter, category=None)| 
 | a gtk.TextIter | 
| 
 | category to search for or None. | 
| Returns : | whether iter moved. | 
      The forward_iter_to_source_mark() method moves iter to the
      position of the next gtksourceview2.Mark
      of the given category. Returns True if iter was moved.
      If category is None, the previous source mark can be of any category.
    
    def get_highlight_matching_brackets()| Returns : | Trueif the matching brackets highlight is active,Falseotherwise. | 
      The get_highlight_matching_brackets() method determines whether
      bracket match highlighting is activated for the source buffer.
    
    def get_highlight_syntax()| Returns : | Trueif the source highlighting is activated in the buffer,Falseotherwise. | 
      The get_highlight_syntax() method determines whether
      syntax highlighting is activated in the source buffer.
    
    def get_language()| Returns : | the gtksourceview2.Languageset byset_language. | 
      The get_language() method returns the 
        gtksourceview2.Language 
        associated with the buffer, see
        gtksourceview2.Buffer.set_language().
    
    def get_source_marks_at_iter(iter, category=None)| 
 | a gtk.TextIter. | 
| 
 | category to search for or None | 
| Returns : | a list of gtksourceview2.Mark. | 
      The get_source_marks_at_iter() method returns the list of marks
      of the given category at iter. If category is None
      it returns all marks at iter.
    
    def get_source_marks_at_line(iter, category=None)| 
 | a gtk.TextIter. | 
| 
 | category to search for or None | 
| Returns : | a list of gtksourceview2.Mark. | 
      The get_source_marks_at_line() method returns the list of marks
      of the given category at line. If category is None
      it returns all marks at line.
    
    def get_max_undo_levels()| Returns : | the maximum number of possible undo levels or -1 if no limit is set. | 
      The get_max_undo_levels() method determines the number
      of undo levels the buffer will track for buffer edits.
    
    def get_style_scheme()| Returns : | the gtksourceview2.StyleSchemeset bygtksourceview2.Buffer.set_style_scheme(),
          orNone. | 
    The get_style_scheme() method returns the nearest marker to
    the right of iter. If there are multiple markers at the same position, 
    this function will always return the first one (from the internal linked list), even if starting the search exactly at its location. 
    You can get the others using gtksourceview2.Marker.next().
    
    def redo()
      The redo() method redoes the last undo operation. Use 
      gtksourceview2.Buffer.can_redo
      to check whether a call to this function will have any effect.
    
    def remove_source_marks(start, end, category=None)| 
 | a gtk.TextIter | 
| 
 | a gtk.TextIter | 
| 
 | category to search for or None. | 
      The remove_source_marks() method remove all marks of category
      between start and end from the buffer. If category is None,
      all marks in the range will be removed.
    
    def set_highlight_matching_brackets(highlight)| 
 | Trueif you want matching brackets highlighted. | 
      The set_highlight_matching_brackets() method Controls the bracket
      match highlighting function in the buffer. If activated, when you position your
      ursor over a bracket character (a parenthesis, a square bracket, etc.) the matching
      opening or closing bracket character will be highlighted.
	  
    def set_highlight_syntax(highlight)| 
 | Trueto enable syntax highlighting,Falseto disable it. | 
        The set_highlight_syntax() method controls whether syntax
        is highlighted in the buffer. If highlight is True, the text
        will be highlighted according to the syntax patterns specified in the language set
        with gtksourceview2.Buffer.set_language().
        If highlight is False, syntax highlighting is disabled and all
        the GtkTextTag objects that have been added by the syntax highlighting
        engine are removed from the buffer.
      
    def set_language(language)| 
 | A gtksourceview2.LanguageorNone. | 
      The set_language() method associate a
      gtksourceview2.Language
      with the source buffer. If language is not-None and syntax highlighting is
      enabled (see gtksourceview2.Buffer.set_highlight_syntax()),
      the syntax patterns defined in language will be used to highlight the text contained in the buffer.
      If language is None, the text contained in the buffer is not highlighted.
	  
    def set_max_undo_levels(max_undo_levels)| 
 | the desired maximum number of undo levels. | 
        The set_max_undo_levels() method sets the number of undo levels for user actions
        the buffer will track. If the number of user actions exceeds the limit set by this function, older actions will be discarded.
      
If max_undo_levels is -1, no limit is set.
        A new action is started whenever the function 
        gtk.TextBuffer.begin_user_action
        is called. In general, this happens whenever the user presses any key which modifies the buffer, but the undo manager 
        will try to merge similar consecutive actions, such as multiple character insertions into one action. 
        But, inserting a newline does start a new action.
      
    def set_style_scheme(scheme)| 
 | a style scheme. | 
        The set_style_scheme() method sets the style scheme used by the buffer.
      
    def undo()
      The undo() Undoes the last user action which modified the buffer. Use 
      gtksourceview2.Buffer.can_undo 
      to check whether a call to this function will have any effect.
    
      Actions are defined as groups of operations between a call to 
      gtk.TextBuffer.begin_user_action() and 
      gtk.TextBuffer.end_user_action(), 
      or sequences of similar edits (inserts or deletes) on the same line.
    
    def callback(sourcebuffer, start, end, user_param1, ...)| 
 | the sourcebuffer that received the signal | 
| 
 | the gtk.TextIterat the start of the updated region. | 
| 
 | the gtk.TextIterat the end of the updated region. | 
| 
 | the first user parameter (if any) specified with the connect() method | 
| 
 | additional user parameters (if any) | 
The "highlight-updated" signal is emitted whenever the syntax highlighting information has been updated, so that views can request a redraw if the region changed is visible. Usually only view widgets displaying this buffer will be interested in this signal.
    def callback(sourcebuffer, arg1, user_param1, ...)| 
 | the sourcebuffer that received the signal | 
| 
 | the gtk.TextMarkat the location where the change occurred. | 
| 
 | the first user parameter (if any) specified with the connect() method | 
| 
 | additional user parameters (if any) | 
The "source-mark-updated" signal is emitted whenever a mark is added to, moved or removed from the buffer.
    def gtksourceview2.iter_backward_search(iter, str, flags, limit)| iter : | a gtk.TextIterwhere the search begins. | 
| str : | search string. | 
| flags : | bitmask of flags affecting the search. | 
| limit : | location of last possible match_start, or Nonefor start of buffer. | 
| Returns : | start of match and end of match | 
        The iter_backward_search() function is the same as the
		gtksourceview2.iter_forward_search()
		function, except searches backward.
      
    def gtksourceview2.iter_forward_search(iter, str, flags, limit)| iter : | a gtk.TextIterwhere the search begins. | 
| str : | search string. | 
| flags : | bitmask of flags affecting the search. | 
| limit : | bound for the search, or Nonefor the end of the buffer. | 
| Returns : | start of match and end of match | 
        The iter_forward_search() function searches forward for str
		and returns a tuple containing gtk.TextIter
		objects that point at the start and end locations of the match.
		The search will not continue past limit. Note that a search is a linear or O(n) operation,
		so you may wish to use limit to avoid locking up your UI on large buffers.
      
If the gtksourceview2.SOURCE_SEARCH_VISIBLE_ONLY flag is present, the match may have invisible text interspersed in str. i.e. str will be a possibly-noncontiguous subsequence of the matched range. similarly, if you specify gtksourceview2.SOURCE_SEARCH_TEXT_ONLY, the match may have pixbufs or child widgets mixed inside the matched range. If these flags are not given, the match must be exact; the special 0xFFFC character in str will match embedded pixbufs or child widgets. If you specify the gtksourceview2.SOURCE_SEARCH_CASE_INSENSITIVE flag, the text will be matched regardless of what case it is in.
		Same as gtk.TextIter.forward_search(),
		but supports case insensitive searching.