org.gnome.gtk

## Class TextMark

- Object
- - org.freedesktop.bindings.Pointer
  - - org.freedesktop.bindings.Proxy
    - - org.gnome.glib.Object
      - - org.gnome.gtk.TextMark

-     public class TextMark
      extends Object

  A stable reference to a specific position within a TextBuffer.

  TextIters are transient pointers to positions within TextBuffers which are invalidated when their TextBuffer is modified, so you can't "save" them. If you need to preserve a position for later reuse, then get a TextMark by calling TextBuffer's `createMark()` on it.

  There are two "standard" TextMarks available in all TextBuffers, relating to the cursor and the current selection. See `getInsert()` and `getSelectionBound()`.

  Instances of this class fill the same role for TextBuffers that `TreeRowReference` does in providing stability for rows pointed to transiently by TreeIters that come from TreeModels.

  Since:
    4.0.9
  Author:
    Andrew Cowie

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `LEFT` Left-gravity.
    `static boolean` | `RIGHT` Right-gravity.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `TextBuffer` | `getBuffer()` Get the TextBuffer that this TextMark points into.
    `TextIter` | `getIter()` Get a currently valid TextIter indicating where in the TextBuffer this TextMark is pointing.

    - ### Methods inherited from class org.freedesktop.bindings.Pointer

      `toString`

    - ### Methods inherited from class Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### LEFT

          public static final boolean LEFT

      Left-gravity. This is a convenience constant that can be used when creating a TextMark with `createMark()`. The TextMark will stay fixed to the left if text is added there.
      See Also:
        Constant Field Values

    - #### RIGHT

          public static final boolean RIGHT

      Right-gravity. Used when creating a TextMark via `createMark()`. The TextMark will move to the right if text is added there. The insert TextMark (your cursor) has right-gravity.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getBuffer

          public TextBuffer getBuffer()

      Get the TextBuffer that this TextMark points into.
      Since:
        4.0.9

    - #### getIter

          public TextIter getIter()

      Get a currently valid TextIter indicating where in the TextBuffer this TextMark is pointing. This is a convenience method for the common case where you have a series of TextMarks but need to call various TextBuffer insertion or markup related methods, all of which take TextIter arguments.

      The usual caveats about changes invalidating iterators apply, but if you use these inline you will have no problems. For example, given TextMarks `start`, `end` and a TextTag of some sort, you could easily do:

           buffer.applyTag(bold, start.getIter(), end.getIter());

      which is very straight forward. If you are using the same position repeatedly, however, and not changing the TextBuffer, then it is far more efficient to convert the TextMark into a TextIter once and use that directly.
      Since:
        4.0.9