Anjuta Developers Reference Manual: IAnjutaEditorSelection

## IAnjutaEditorSelection IAnjutaEditorSelection — Text editor selection interface |

## Stability Level

Unstable, unless otherwise indicated

## Functions

GQuark | ianjuta_editor_selection_error_quark ()
gchar * | ianjuta_editor_selection_get ()
IAnjutaIterable * | ianjuta_editor_selection_get_end ()
IAnjutaIterable * | ianjuta_editor_selection_get_start ()
gboolean | ianjuta_editor_selection_has_selection ()
void | ianjuta_editor_selection_replace ()
void | ianjuta_editor_selection_select_all ()
void | ianjuta_editor_selection_select_block ()
void | ianjuta_editor_selection_select_function ()
void | ianjuta_editor_selection_set ()

## Types and Values

#define | IANJUTA_EDITOR_SELECTION_ERROR

## Object Hierarchy

        GInterface
        ╰── IAnjutaEditorSelection

## Includes

    #include <libanjuta/interfaces/ianjuta-editor-selection.h>

## Description

## Functions

### ianjuta_editor_selection_error_quark ()

    GQuark
    ianjuta_editor_selection_error_quark (void);

#### Returns

### ianjuta_editor_selection_get ()

    gchar *
    ianjuta_editor_selection_get (IAnjutaEditorSelection *obj,
                                  GError **err);

Gets curerntly selected text in editor.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

A newly allocated buffer of currently selected characters. NULL if there is no selection. The returned buffer must be freed after use.

### ianjuta_editor_selection_get_end ()

    IAnjutaIterable *
    ianjuta_editor_selection_get_end (IAnjutaEditorSelection *obj,
                                      GError **err);

Get end position of selection. If there is no selection, returns NULL.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

End of selection or NULL if there is no selection.

### ianjuta_editor_selection_get_start ()

    IAnjutaIterable *
    ianjuta_editor_selection_get_start (IAnjutaEditorSelection *obj,
                                        GError **err);

Gets start position of selection text.

Return: Start of selection or NULL if there is no selection.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

### ianjuta_editor_selection_has_selection ()

    gboolean
    ianjuta_editor_selection_has_selection
                                   (IAnjutaEditorSelection *obj,
                                    GError **err);

Returns TRUE if editor has any text selected. The selection positions can be retrieved with `ianjuta_editor_selection_get_start()` and `ianjuta_editor_selection_get_end()`.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

TRUE if there is text selected else FALSE.

### ianjuta_editor_selection_replace ()

    void
    ianjuta_editor_selection_replace (IAnjutaEditorSelection *obj,
                                      const gchar *text,
                                      gint length,
                                      GError **err);

Replaces currently selected text with the `text` . Only `length` amount of characters are used from `text` buffer to replace.

#### Parameters

obj | Self |
text | Replacement text. |
length | Length of the text to used in `text` . |
err | Error propagation and reporting |

### ianjuta_editor_selection_select_all ()

    void
    ianjuta_editor_selection_select_all (IAnjutaEditorSelection *obj,
                                         GError **err);

### ianjuta_editor_selection_select_block ()

    void
    ianjuta_editor_selection_select_block (IAnjutaEditorSelection *obj,
                                           GError **err);

Selects current block of code. The definition of block of code depends on highlight mode used (programming language). Some highlight mode does not have block concept, in that case this method does not do anything.

#### Parameters

obj | Self |
err | Error propagation and reporting |

### ianjuta_editor_selection_select_function ()

    void
    ianjuta_editor_selection_select_function
                                   (IAnjutaEditorSelection *obj,
                                    GError **err);

Select current function block. The definition of function block depends on highlight mode used (programming language). Some highlight mode does not have function concept, in that case this method does not do anything.

#### Parameters

obj | Self |
err | Error propagation and reporting |

### ianjuta_editor_selection_set ()

    void
    ianjuta_editor_selection_set (IAnjutaEditorSelection *obj,
                                  IAnjutaIterable *start,
                                  IAnjutaIterable *end,
                                  gboolean scroll,
                                  GError **err);

Select characters between start and end. Start and end don't have to be ordered.

#### Parameters

obj | Self |
start | Begin of selection |
end | End of selection |
scroll | Scroll selection onscreen |
err | Error propagation and reporting |

## Types and Values

### IANJUTA_EDITOR_SELECTION_ERROR

    #define IANJUTA_EDITOR_SELECTION_ERROR ianjuta_editor_selection_error_quark()