Method

PangoLayoutmove_cursor_visually

Declaration [src]

void
pango_layout_move_cursor_visually (
  PangoLayout* layout,
  gboolean strong,
  int old_index,
  int old_trailing,
  int direction,
  int* new_index,
  int* new_trailing
)

Description [src]

Computes a new cursor position from an old position and a direction.

If direction is positive, then the new position will cause the strong or weak cursor to be displayed one position to right of where it was with the old cursor position. If direction is negative, it will be moved to the left.

In the presence of bidirectional text, the correspondence between logical and visual order will depend on the direction of the current run, and there may be jumps when the cursor is moved off of the end of a run.

Motion here is in cursor positions, not in characters, so a single call to this function may move the cursor over multiple characters when multiple characters combine to form a single grapheme.

Parameters

strong

Type: gboolean

Whether the moving cursor is the strong cursor or the weak cursor. The strong cursor is the cursor corresponding to text insertion in the base direction for the layout.

old_index

Type: int

The byte index of the current cursor position.

old_trailing

Type: int

If 0, the cursor was at the leading edge of the grapheme indicated by old_index, if > 0, the cursor was at the trailing edge.

direction

Type: int

Direction to move cursor. A negative value indicates motion to the left.

new_index

Type: int*

Location to store the new cursor byte index. A value of -1 indicates that the cursor has been moved off the beginning of the layout. A value of G_MAXINT indicates that the cursor has been moved off the end of the layout.

The argument will be set by the function.
new_trailing

Type: int*

Number of characters to move forward from the location returned for new_index to get the position where the cursor should be displayed. This allows distinguishing the position at the beginning of one line from the position at the end of the preceding line. new_index is always on the line where the cursor should be displayed.

The argument will be set by the function.