13.5. Text Marks

A TextMark indicates a location in a TextBuffer between two characters that is preserved across buffer modifications. TextMarks are created, moved and deleted using the TextBuffer methods as described in the TextBuffer section.

A TextBuffer has two built-in TextMarks named: insert and selection_bound which refer to the insertion point and the boundary of the selection (these may refer to the same location).

The name of a TextMark can be retrieved using the method:

  name = textmark.get_name()

By default marks other than insert are not visible (displayed as a vertical bar). The visibility of a mark can be set and retrieved using the methods:

  setting = textmark.get_visible()

  textmark.set_visible(setting)

where setting is TRUE if the mark is visible.

The TextBuffer that contains a TextMark can be obtained using the method:

  buffer = textmark.get_buffer()

You can determine whether a TextMark has been deleted using the method:

  setting = textmark.get_deleted()

The left gravity of a TextMark can be retrieved using the method:

  setting = textmark.get_left_gravity()

The left gravity of a TextMark indicates where the mark will end up after an insertion. If left gravity is TRUE the mark will be to the left of the insertion; if FALSE, to the right of the insertion.