InfText.MoveOperation

g GObject.GInterface GObject.GInterface Infinity.AdoptedOperation Infinity.AdoptedOperation GObject.GInterface->Infinity.AdoptedOperation GObject.Object GObject.Object InfText.MoveOperation InfText.MoveOperation GObject.Object->InfText.MoveOperation Infinity.AdoptedOperation->InfText.MoveOperation

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Infinity.AdoptedOperation (8)

Structs:

GObject.ObjectClass (5)

class

new (position, length)

class

transform_delete (delete_position, delete_length, move_position, move_length)

class

transform_insert (insert_position, insert_length, move_position, move_length, left_gravity)

get_length ()

get_position ()

Virtual Methods

Inherited:

GObject.Object (7), Infinity.AdoptedOperation (7)

Properties

Name

Type

Flags

Short Description

length

int

r/w/co

The number of characters of the selected text

position

int

r/w/co

Position where to place the user’s caret at

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class InfText.MoveOperation(**kwargs)
Bases:

GObject.Object, Infinity.AdoptedOperation

Abstract:

No

Structure:

InfText.MoveOperationClass

classmethod new(position, length)
Parameters:
  • position (int) – The position to place the user’s caret at.

  • length (int) – The number of characters to select. Negative means selection towards the beginning of the buffer.

Returns:

A new InfText.MoveOperation.

Return type:

InfText.MoveOperation

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

classmethod transform_delete(delete_position, delete_length, move_position, move_length)
Parameters:
  • delete_position (int) – The position at which text is deleted.

  • delete_length (int) – The number of deleted characters.

  • move_position (int) – Points to the character offset to which the caret is moved.

  • move_length (int) – Points to the number of characters selected. Negative means towards the beginning.

Returns:

move_position:

Points to the character offset to which the caret is moved.

move_length:

Points to the number of characters selected. Negative means towards the beginning.

Return type:

(move_position: int, move_length: int)

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

classmethod transform_insert(insert_position, insert_length, move_position, move_length, left_gravity)
Parameters:
  • insert_position (int) – The position at which text is inserted.

  • insert_length (int) – The number of inserted characters.

  • move_position (int) – Points to the character offset to which the caret is moved.

  • move_length (int) – Points to the number of characters selected. Negative means towards the beginning.

  • left_gravity (bool) – Whether the move position and length have left gravity.

Returns:

move_position:

Points to the character offset to which the caret is moved.

move_length:

Points to the number of characters selected. Negative means towards the beginning.

Return type:

(move_position: int, move_length: int)

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.

get_length()
Returns:

The length of self.

Return type:

int

Returns the length to which self changes the user’s selection. Negative means selection towards the beginning of the buffer.

get_position()
Returns:

The position of self.

Return type:

int

Returns the position at which self places the user’s cursor.

Property Details

InfText.MoveOperation.props.length
Name:

length

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The number of characters of the selected text

InfText.MoveOperation.props.position
Name:

position

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Position where to place the user’s caret at