## IAnjutaEditor IAnjutaEditor — Text editor interface |

## Stability Level

Unstable, unless otherwise indicated

## Functions

GQuark | ianjuta_editor_error_quark ()
void | ianjuta_editor_append ()
void | ianjuta_editor_erase ()
void | ianjuta_editor_erase_all ()
gint | ianjuta_editor_get_column ()
gchar * | ianjuta_editor_get_current_word ()
IAnjutaIterable * | ianjuta_editor_get_end_position ()
gint | ianjuta_editor_get_indentsize ()
gint | ianjuta_editor_get_length ()
IAnjutaIterable * | ianjuta_editor_get_line_begin_position ()
IAnjutaIterable * | ianjuta_editor_get_line_end_position ()
int | ianjuta_editor_get_line_from_position ()
gint | ianjuta_editor_get_lineno ()
gint | ianjuta_editor_get_offset ()
gboolean | ianjuta_editor_get_overwrite ()
IAnjutaIterable * | ianjuta_editor_get_position ()
IAnjutaIterable * | ianjuta_editor_get_position_from_offset ()
IAnjutaIterable * | ianjuta_editor_get_start_position ()
gint | ianjuta_editor_get_tabsize ()
gchar * | ianjuta_editor_get_text ()
gchar * | ianjuta_editor_get_text_all ()
gboolean | ianjuta_editor_get_use_spaces ()
void | ianjuta_editor_goto_end ()
void | ianjuta_editor_goto_line ()
void | ianjuta_editor_goto_position ()
void | ianjuta_editor_goto_start ()
void | ianjuta_editor_insert ()
void | ianjuta_editor_set_auto_indent ()
void | ianjuta_editor_set_indentsize ()
void | ianjuta_editor_set_popup_menu ()
void | ianjuta_editor_set_tabsize ()
void | ianjuta_editor_set_use_spaces ()

## Signals

void | backspace | Run Last
void | changed | Run Last
void | char-added | Run Last
void | code-changed | Run Last
void | cursor-moved | Run Last
void | glade-callback-add | Run Last
void | glade-member-add | Run Last
void | line-marks-gutter-clicked | Run Last

## Types and Values

#define | IANJUTA_EDITOR_PREF_SCHEMA
#define | IANJUTA_EDITOR_USE_TABS_KEY
#define | IANJUTA_EDITOR_TAB_WIDTH_KEY
#define | IANJUTA_EDITOR_INDENT_WIDTH_KEY
enum | IAnjutaEditorAttribute

## Object Hierarchy

        GEnum
        ├── IAnjutaEditorAttribute
        ╰── IAnjutaEditorError
        GInterface
        ╰── IAnjutaEditor

## Includes

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

## Description

## Functions

### ianjuta_editor_error_quark ()

    GQuark
    ianjuta_editor_error_quark (void);

### ianjuta_editor_append ()

    void
    ianjuta_editor_append (IAnjutaEditor *obj,
                           const gchar *text,
                           gint length,
                           GError **err);

Appends `length` characters from `text` buffer at the end of editor buffer. If `length` is -1, the whole `text` is used. `length` is in bytes.

#### Parameters

obj | Self |
text | Text to append. |
length | Length of `text` to use. |
err | Error propagation and reporting |

### ianjuta_editor_erase ()

    void
    ianjuta_editor_erase (IAnjutaEditor *obj,
                          IAnjutaIterable *position_start,
                          IAnjutaIterable *position_end,
                          GError **err);

### ianjuta_editor_erase_all ()

    void
    ianjuta_editor_erase_all (IAnjutaEditor *obj,
                              GError **err);

Empties the whole editor buffer. There will be zero characters. After the erase operation, none of the active iters are guranteed to be valid.

#### Parameters

obj | Self |
err | Error propagation and reporting |

### ianjuta_editor_get_column ()

    gint
    ianjuta_editor_get_column (IAnjutaEditor *obj,
                               GError **err);

### ianjuta_editor_get_current_word ()

    gchar *
    ianjuta_editor_get_current_word (IAnjutaEditor *obj,
                                     GError **err);

Obtains the word on which carat is currently on.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

Current word.

### ianjuta_editor_get_end_position ()

    IAnjutaIterable *
    ianjuta_editor_get_end_position (IAnjutaEditor *obj,
                                     GError **err);

Gets the iter positioned at the end of the editor buffer. The returned iter is the end-iter which does not point to any valid character in the buffer (it is pointed one step beyond the last valid character).

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

Cell iter set to the end of the editor (end-iter).

[transfer none]

### ianjuta_editor_get_indentsize ()

    gint
    ianjuta_editor_get_indentsize (IAnjutaEditor *obj,
                                   GError **err);

Returns the indentation size in spaces currently used by the editor.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

indentation size in number of spaces

### ianjuta_editor_get_length ()

    gint
    ianjuta_editor_get_length (IAnjutaEditor *obj,
                               GError **err);

Get length of complete text in editor. This will be the total number of bytes in the file or buffer.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

Text length.

### ianjuta_editor_get_line_begin_position ()

    IAnjutaIterable *
    ianjuta_editor_get_line_begin_position
                                   (IAnjutaEditor *obj,
                                    gint line,
                                    GError **err);

fixme

#### Parameters

obj | Self |
line | fixme |
err | Error propagation and reporting. |

#### Returns

fixme.

[transfer full]

### ianjuta_editor_get_line_end_position ()

    IAnjutaIterable *
    ianjuta_editor_get_line_end_position (IAnjutaEditor *obj,
                                          gint line,
                                          GError **err);

fixme

#### Parameters

obj | Self |
line | fixme |
err | Error propagation and reporting. |

#### Returns

fixme.

[transfer full]

### ianjuta_editor_get_line_from_position ()

    int
    ianjuta_editor_get_line_from_position (IAnjutaEditor *obj,
                                           IAnjutaIterable *position,
                                           GError **err);

### ianjuta_editor_get_lineno ()

    gint
    ianjuta_editor_get_lineno (IAnjutaEditor *obj,
                               GError **err);

Obtains current line number on which carat is.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

Line number.

### ianjuta_editor_get_offset ()

    gint
    ianjuta_editor_get_offset (IAnjutaEditor *obj,
                               GError **err);

### ianjuta_editor_get_overwrite ()

    gboolean
    ianjuta_editor_get_overwrite (IAnjutaEditor *obj,
                                  GError **err);

Obtains editor overwirte mode: TRUE = Override, FALSE = Insert.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

editor mode.

### ianjuta_editor_get_position ()

    IAnjutaIterable *
    ianjuta_editor_get_position (IAnjutaEditor *obj,
                                 GError **err);

Get current caret position.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

Iterator that points to the current position.

[transfer full]

### ianjuta_editor_get_position_from_offset ()

    IAnjutaIterable *
    ianjuta_editor_get_position_from_offset
                                   (IAnjutaEditor *obj,
                                    gint offset,
                                    GError **err);

Creates and returns an iter for editor cells. The iter is placed at the unicode character position where the given offset `offset` happens to fall. The returned iter is cell (character) iter and not byte iter, so all iter operations on it are character (not byte) iteration, including all position and index references in the iter.

The iter must be unreferrenced by the caller when done. The iter navigates (next/previous) in step of unicode characters (one unicode character == one cell).

Retrun value: a newly created iter of IAnjutaEditorCell placed at the given `offset` position.

#### Parameters

obj | Self |
offset | Character offset position where the iter will be set |
err | Error propagation and reporting |

### ianjuta_editor_get_start_position ()

    IAnjutaIterable *
    ianjuta_editor_get_start_position (IAnjutaEditor *obj,
                                       GError **err);

Gets the iter positioned at the start of the editor buffer.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

Cell iter set to the begining of the editor.

[transfer none]

### ianjuta_editor_get_tabsize ()

    gint
    ianjuta_editor_get_tabsize (IAnjutaEditor *obj,
                                GError **err);

Returns the tabsize (in spaces) currently used by the editor.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

tabsize in number of spaces

### ianjuta_editor_get_text ()

    gchar *
    ianjuta_editor_get_text (IAnjutaEditor *obj,
                             IAnjutaIterable *begin,
                             IAnjutaIterable *end,
                             GError **err);

Gets text characters beginning from `begin` (including char pointed by `begin` ) and ending with `end` (excluding character pointed by `end` ). The characters returned are utf-8 encoded. The iterators `begin` and `end` could be in either order. The returned text, however, is in right order. If both `begin` and `end` points to the same position, NULL is returned.

#### Parameters

obj | Self |
begin | Begining iterator |
end | End iterator |
err | Error propagation and reporting |

#### Returns

A buffer of utf-8 characters. The returned buffer must be freed when no longer required.

### ianjuta_editor_get_text_all ()

    gchar *
    ianjuta_editor_get_text_all (IAnjutaEditor *obj,
                                 GError **err);

Gets all text characters in the editor. The characters returned are utf-8 encoded.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

A buffer of utf-8 characters containing all text from editor. The returned buffer must be freed when no longer required.

### ianjuta_editor_get_use_spaces ()

    gboolean
    ianjuta_editor_get_use_spaces (IAnjutaEditor *obj,
                                   GError **err);

Returns if the editor uses spaces for filling up tab characters.

#### Parameters

obj | Self |
err | Error propagation and reporting |

#### Returns

TRUE if yes, FALSE if no.

### ianjuta_editor_goto_end ()

    void
    ianjuta_editor_goto_end (IAnjutaEditor *obj,
                             GError **err);

Carat is moved to the end of editor and text view is scrolled to bring it in viewable area of the editor.

#### Parameters

obj | Self |
err | Error propagation and reporting |

### ianjuta_editor_goto_line ()

    void
    ianjuta_editor_goto_line (IAnjutaEditor *obj,
                              gint lineno,
                              GError **err);

Carat is moved to the given `lineno` line and text view is scrolled to bring it in viewable area of the editor.

#### Parameters

obj | Self |
lineno | line number where carat will be moved. |
err | Error propagation and reporting |

### ianjuta_editor_goto_position ()

    void
    ianjuta_editor_goto_position (IAnjutaEditor *obj,
                                  IAnjutaIterable *position,
                                  GError **err);

Carat is moved to the given `position` and text view is scrolled to bring `position` in viewable area of the editor.

#### Parameters

obj | Self |
position | Character position where carat will be moved. |
err | Error propagation and reporting |

### ianjuta_editor_goto_start ()

    void
    ianjuta_editor_goto_start (IAnjutaEditor *obj,
                               GError **err);

Carat is moved to the begining of editor and text view is scrolled to bring it in viewable area of the editor.

#### Parameters

obj | Self |
err | Error propagation and reporting |

### ianjuta_editor_insert ()

    void
    ianjuta_editor_insert (IAnjutaEditor *obj,
                           IAnjutaIterable *position,
                           const gchar *text,
                           gint length,
                           GError **err);

Inserts `length` characters from `text` buffer at given `position` of editor buffer. If `length` is -1, the whole `text` is used.

#### Parameters

obj | Self |
position | Character position in editor where insert will take place. |
text | Text to append. |
length | Length of `text` to use. |
err | Error propagation and reporting |

### ianjuta_editor_set_auto_indent ()

    void
    ianjuta_editor_set_auto_indent (IAnjutaEditor *obj,
                                    gboolean auto_indent,
                                    GError **err);

Sets whether the editor should auto-indent itself. A plugin that does custom auto-indent can set this to false and override the preferences setting

#### Parameters

obj | Self |
auto_indent | TRUE to enable auto-indent, FALSE to disable |

### ianjuta_editor_set_indentsize ()

    void
    ianjuta_editor_set_indentsize (IAnjutaEditor *obj,
                                   gint indentsize,
                                   GError **err);

Sets the indentation size of the editor.

#### Parameters

obj | Self |
indentsize | Indentation size in spaces |
err | Error propagation and reporting |

### ianjuta_editor_set_popup_menu ()

    void
    ianjuta_editor_set_popup_menu (IAnjutaEditor *obj,
                                   GtkWidget *menu,
                                   GError **err);

Set Editor popup menu. This is the menu shown in the editor when one right-clicks on it.

#### Parameters

obj | Self |
menu | Popupmenu |
err | Error propagation and reporting |

### ianjuta_editor_set_tabsize ()

    void
    ianjuta_editor_set_tabsize (IAnjutaEditor *obj,
                                gint tabsize,
                                GError **err);

Sets the tabsize of the editor.

#### Parameters

obj | Self |
tabsize | Tabsize in spaces |
err | Error propagation and reporting |

### ianjuta_editor_set_use_spaces ()

    void
    ianjuta_editor_set_use_spaces (IAnjutaEditor *obj,
                                   gboolean use_spaces,
                                   GError **err);

## Types and Values

### IANJUTA_EDITOR_PREF_SCHEMA

    #define IANJUTA_EDITOR_PREF_SCHEMA "editor"

Schema id used to store common editor settings.

### IANJUTA_EDITOR_USE_TABS_KEY

    #define IANJUTA_EDITOR_USE_TABS_KEY "use-tabs"

Boolean key, true is tabs has to be used for indenting.

### IANJUTA_EDITOR_TAB_WIDTH_KEY

    #define IANJUTA_EDITOR_TAB_WIDTH_KEY "tab-width"

Integer key, defines the size of a tabulation in spaces.

### IANJUTA_EDITOR_INDENT_WIDTH_KEY

    #define IANJUTA_EDITOR_INDENT_WIDTH_KEY "indent-width"

Integer key, defines the number a space for one indentation step.

### enum IAnjutaEditorAttribute

This enumeration is used to specify the type of text. Note that not all editors implement this.

#### Members

IANJUTA_EDITOR_TEXT | Normal text |
IANJUTA_EDITOR_KEYWORD | A keyword of the programming language |
IANJUTA_EDITOR_COMMENT | A comment |
IANJUTA_EDITOR_STRING | A string |

## Signal Details

### The `“backspace”` signal

    void
    user_function (IAnjutaEditor *obj,
                   gpointer       user_data)

The signal is emitted when the user presses backspace

#### Parameters

obj | Self |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“changed”` signal

    void
    user_function (IAnjutaEditor   *position,
                   IAnjutaIterable *added,
                   gboolean         length,
                   int              lines,
                   int              text,
                   char            *obj,
                   gpointer         user_data)

This signal is emitted when any text change happens in editor. The changes begin at `position` . `text` is not garanteed to be NULL terminated. Use `length` to read the text. `lines` represent the number of line breaks in the added or removed text.

#### Parameters

position | The iter position where change happend. |
added | TRUE if added, FALSE if deleted. |
length | Length of the text changed. |
lines | Number of lines added or removed. |
text | The text added or removed. |
obj | Self |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“char-added”` signal

    void
    user_function (IAnjutaEditor   *position,
                   IAnjutaIterable *ch,
                   char             obj,
                   gpointer         user_data)

This signal is emitted when any character is added inside the editor. The newly added character is `ch` which has been inserted at `position` .

#### Parameters

position | The iter position where `ch` is added. |
ch | The character that has been added. |
obj | Self |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“code-changed”` signal

    void
    user_function (IAnjutaEditor   *position,
                   IAnjutaIterable *code,
                   char            *obj,
                   gpointer         user_data)

This signal is emitted when code is changed inside the editor. When such information is availabe, `position` stores the position where `code` was added.

#### Parameters

position | The iter position where code has been changed or NULL. |
code | The code that has been added or NULL. |
obj | Self |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“cursor-moved”` signal

    void
    user_function (IAnjutaEditor *obj,
                   gpointer       user_data)

The signal is a hint that the cursor was moved.

#### Parameters

obj | Self |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“glade-callback-add”` signal

    void
    user_function (IAnjutaEditor *widget_typename,
                   char          *signal_name,
                   char          *handler_name,
                   char          *object,
                   char          *swap,
                   gboolean       after,
                   gboolean       filename,
                   char          *obj,
                   gpointer       user_data)

This signal is emitted when code for a widget must be generated.

#### Parameters

widget_typename | Name of the type of the widget. |
signal_name | Name of the signal. |
handler_name | Name of the signal handler. |
object | Name of the object to be passed. |
swap | The "swap" signal property. |
after | The "after" signal property. |
filename | Path for the .ui file that generated the signal. |
obj | Self |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“glade-member-add”` signal

    void
    user_function (IAnjutaEditor *widget_typename,
                   char          *widget_name,
                   char          *filename,
                   char          *obj,
                   gpointer       user_data)

This signal is emitted when code for a widget must be generated.

#### Parameters

widget_typename | Name of the type of the widget that will become a member of the class. |
widget_name | Name of the widget that will become a member of the class. |
filename | Path for the .ui file that generated the signal. |
obj | Self |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“line-marks-gutter-clicked”` signal

    void
    user_function (IAnjutaEditor *obj,
                   int            double_click,
                   gpointer       user_data)

The signal is emitted when the user clicks on a marker

#### Parameters

obj | Self |
double_click | whether the line marks gutter was double clicked |
location | location of the clicked marker |
user_data | user data set when the signal handler was connected. |

Flags: Run Last