InfTextMoveOperation: libinftext-0.7 Reference Manual

## InfTextMoveOperation InfTextMoveOperation |

## Functions

InfTextMoveOperation * | inf_text_move_operation_new ()
guint | inf_text_move_operation_get_position ()
gint | inf_text_move_operation_get_length ()
void | inf_text_move_operation_transform_insert ()
void | inf_text_move_operation_transform_delete ()

## Properties

gint | length | Read / Write / Construct Only
guint | position | Read / Write / Construct Only

## Types and Values

struct | InfTextMoveOperation
struct | InfTextMoveOperationClass

## Object Hierarchy

        GObject
        ╰── InfTextMoveOperation

## Implemented Interfaces

InfTextMoveOperation implements InfAdoptedOperation.

## Description

## Functions

### inf_text_move_operation_new ()

    InfTextMoveOperation *
    inf_text_move_operation_new (guint position,
                                 gint length);

Creates a new move operation that, when applied, changes the caret and selection of the applying user.

[constructor]

#### Parameters

position | The position to place the user's caret at. |
length | The number of characters to select. Negative means selection towards the beginning of the buffer. |

#### Returns

A new InfTextMoveOperation.

[transfer full]

### inf_text_move_operation_get_position ()

    guint
    inf_text_move_operation_get_position (InfTextMoveOperation *operation);

Returns the position at which `operation` places the user's cursor.

#### Parameters

operation | A InfTextMoveOperation. |

#### Returns

The position of `operation` .

### inf_text_move_operation_get_length ()

    gint
    inf_text_move_operation_get_length (InfTextMoveOperation *operation);

Returns the length to which `operation` changes the user's selection. Negative means selection towards the beginning of the buffer.

#### Parameters

operation | A InfTextMoveOperation. |

#### Returns

The length of `operation` .

### inf_text_move_operation_transform_insert ()

    void
    inf_text_move_operation_transform_insert
                                   (guint insert_position,
                                    guint insert_length,
                                    guint *move_position,
                                    gint *move_length,
                                    gboolean left_gravity);

Changes *`move_position` and *`move_length` so that they point to the same region when `insert_length` characters are inserted at `insert_position` .

If text is inserted at the same position as `move_position` , then `move_position` is kept at the position it currently is if `left_gravity` is `TRUE`, otherwise it is shifted to the right.

If *`move_length` is nonzero, then the selection length is never enlarged if text is inserted at the selection bounds, not depending on whether `left_gravity` is set or not.

#### Parameters

insert_position | The position at which text is inserted. |
insert_length | The number of inserted characters. |
move_position | Points to the character offset to which the caret is moved. | [inout]
move_length | Points to the number of characters selected. Negative means towards the beginning. | [inout]
left_gravity | Whether the move position and length have left gravity. |

### inf_text_move_operation_transform_delete ()

    void
    inf_text_move_operation_transform_delete
                                   (guint delete_position,
                                    guint delete_length,
                                    guint *move_position,
                                    gint *move_length);

Changes *`move_position` and *`move_length` so that they point to the same region when `delete_length` characters are deleted starting from `delete_position` .

#### Parameters

delete_position | The position at which text is deleted. |
delete_length | The number of deleted characters. |
move_position | Points to the character offset to which the caret is moved. | [inout]
move_length | Points to the number of characters selected. Negative means towards the beginning. | [inout]

## Types and Values

### struct InfTextMoveOperation

    struct InfTextMoveOperation;

### struct InfTextMoveOperationClass

    struct InfTextMoveOperationClass {
      GObjectClass parent_class;
    };

## Property Details

### The `“length”` property

      “length”                   gint

The number of characters of the selected text.

Owner: InfTextMoveOperation

Flags: Read / Write / Construct Only

Default value: 0

### The `“position”` property

      “position”                 guint

Position where to place the user's caret at.

Owner: InfTextMoveOperation

Flags: Read / Write / Construct Only

Default value: 0