org.gnome.gtk

## Interface TextBuffer.MarkSet

- Enclosing class:
    TextBuffer

      public static interface TextBuffer.MarkSet

  Signal emitted when a TextMark is set (or moved) in this TextBuffer.

  This can be used as a way to react to the cursor moving. The cursor is, of course, represented by the insert TextMark, and so, doing:

       insert = buffer.getInsert();

       buffer.connect(new TextBuffer.MarkSet() {
           public void onMarkSet(TextBuffer source, org.gnome.gtk.TextIter location, TextMark mark) {
               if (mark == insert) {
                   // react!
               }
           }
       });

  will allow you to react to the cursor moving.

  Somewhat counter-intuitively, however, inserting text does not "move" a TextMark; the insert TextMark will flow right according to its gravity as text is added. Using the arrow keys or mouse to move the cursor will, on the other hand, result in this signal being emitted.

  While an interesting example, doing this to track the cursor changing isn't actually a good idea. You get a `TextBuffer.MarkSet` callback for every TextMark being set (including ones used internally by GTK!) which means lots of activity that has nothing to do with you. Use `TextBuffer.NotifyCursorPosition` instead.

  Using signal is very inefficient; why this is a signal on TextBuffer and not a signal coming (only) from individual TextMarks is mystery.

  Since:
    4.0.10
  Author:
    Andrew Cowie

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `onMarkSet(TextBuffer source, TextIter location, TextMark mark)`

- - ### Method Detail

    - #### onMarkSet

          void onMarkSet(TextBuffer source,
                       TextIter location,
                       TextMark mark)