TextIter
Object Hierarchy:
Description:
[ CCode ( copy_function = "g_boxed_copy" , free_function = "g_boxed_free" , type_id = "gtk_text_iter_get_type ()" ) ]
public struct TextIter
public struct TextIter
An iterator for the contents of a `GtkTextBuffer`.
You may wish to begin by reading the [text widget conceptual overview](section-text-widget.html), which gives an overview of all the objects and data types related to the text widget and how they work together.
Namespace: Gtk
Package: gtk4
Content:
Methods:
- public void assign (TextIter other)
Assigns the value of
other
to this . - public bool backward_char ()
Moves backward by one character offset.
- public bool backward_chars (int count)
Moves
count
characters backward, if possible. - public bool backward_cursor_position ()
Like [method@Gtk.
- public bool backward_cursor_positions (int count)
Moves up to
count
cursor positions. - public bool backward_find_char (TextCharPredicate pred, TextIter? limit)
Same as [method@Gtk.
- public bool backward_line ()
Moves this to the start of the previous line.
- public bool backward_lines (int count)
Moves
count
lines backward, if possible. - public bool backward_search (string str, TextSearchFlags flags, out TextIter match_start, out TextIter match_end, TextIter? limit)
Same as [method@Gtk.
- public bool backward_sentence_start ()
Moves backward to the previous sentence start.
- public bool backward_sentence_starts (int count)
Calls [method@Gtk.
- public bool backward_to_tag_toggle (TextTag? tag)
Moves backward to the next toggle (on or off) of the
tag
, or to the next toggle of any tag iftag
is null. - public bool backward_visible_cursor_position ()
Moves this backward to the previous visible cursor position.
- public bool backward_visible_cursor_positions (int count)
Moves up to
count
visible cursor positions. - public bool backward_visible_line ()
Moves this to the start of the previous visible line.
- public bool backward_visible_lines (int count)
Moves
count
visible lines backward, if possible. - public bool backward_visible_word_start ()
Moves backward to the previous visible word start.
- public bool backward_visible_word_starts (int count)
Calls [method@Gtk.
- public bool backward_word_start ()
Moves backward to the previous word start.
- public bool backward_word_starts (int count)
Calls [method@Gtk.
- public bool can_insert (bool default_editability)
Considering the default editability of the buffer, and tags that affect editability, determines whether text inserted at this would be editable.
- public int compare (TextIter rhs)
A
qsort
-style function that returns negative if this is less thanrhs
, positive if this is greater thanrhs
, and 0 if they’re equal. - public TextIter? copy ()
Creates a dynamically-allocated copy of an iterator.
- public bool editable (bool default_setting)
Returns whether the character at this is within an editable region of text.
- public bool ends_line ()
Returns true if this points to the start of the paragraph delimiter characters for a line.
- public bool ends_sentence ()
Determines whether this ends a sentence.
- public bool ends_tag (TextTag? tag)
Returns true if
tag
is toggled off at exactly this point. - public bool ends_word ()
Determines whether this ends a natural-language word.
- public bool equal (TextIter rhs)
Tests whether two iterators are equal, using the fastest possible mechanism.
- public bool forward_char ()
Moves this forward by one character offset.
- public bool forward_chars (int count)
Moves
count
characters if possible. - public bool forward_cursor_position ()
Moves this forward by a single cursor position.
- public bool forward_cursor_positions (int count)
Moves up to
count
cursor positions. - public bool forward_find_char (TextCharPredicate pred, TextIter? limit)
Advances this, calling
pred
on each character. - public bool forward_line ()
Moves this to the start of the next line.
- public bool forward_lines (int count)
Moves
count
lines forward, if possible. - public bool forward_search (string str, TextSearchFlags flags, out TextIter match_start, out TextIter match_end, TextIter? limit)
Searches forward for
str
. - public bool forward_sentence_end ()
Moves forward to the next sentence end.
- public bool forward_sentence_ends (int count)
Calls [method@Gtk.
- public void forward_to_end ()
Moves this forward to the “end iterator”, which points one past the last valid character in the buffer.
- public bool forward_to_line_end ()
Moves the iterator to point to the paragraph delimiter characters.
- public bool forward_to_tag_toggle (TextTag? tag)
Moves forward to the next toggle (on or off) of the
tag
, or to the next toggle of any tag iftag
is null. - public bool forward_visible_cursor_position ()
Moves this forward to the next visible cursor position.
- public bool forward_visible_cursor_positions (int count)
Moves up to
count
visible cursor positions. - public bool forward_visible_line ()
Moves this to the start of the next visible line.
- public bool forward_visible_lines (int count)
Moves
count
visible lines forward, if possible. - public bool forward_visible_word_end ()
Moves forward to the next visible word end.
- public bool forward_visible_word_ends (int count)
Calls [method@Gtk.
- public bool forward_word_end ()
Moves forward to the next word end.
- public bool forward_word_ends (int count)
Calls [method@Gtk.
- public void free ()
Free an iterator allocated on the heap.
- public unowned TextBuffer get_buffer ()
Returns the `GtkTextBuffer` this iterator is associated with.
- public int get_bytes_in_line ()
Returns the number of bytes in the line containing this, including the paragraph delimiters.
- public unichar get_char ()
The Unicode character at this iterator is returned.
- public int get_chars_in_line ()
Returns the number of characters in the line containing this, including the paragraph delimiters.
- public unowned TextChildAnchor? get_child_anchor ()
If the location at this contains a child anchor, the anchor is returned.
- public Language get_language ()
Returns the language in effect at this.
- public int get_line ()
Returns the line number containing the iterator.
- public int get_line_index ()
Returns the byte index of the iterator, counting from the start of a newline-terminated line.
- public int get_line_offset ()
Returns the character offset of the iterator, counting from the start of a newline-terminated line.
- public SList<unowned TextMark> get_marks ()
Returns a list of all `GtkTextMark` at this location.
- public int get_offset ()
Returns the character offset of an iterator.
- public unowned Paintable? get_paintable ()
If the element at this is a paintable, the paintable is returned.
- public string get_slice (TextIter end)
Returns the text in the given range.
- public SList<unowned TextTag> get_tags ()
Returns a list of tags that apply to this, in ascending order of priority.
- public string get_text (TextIter end)
Returns text in the given range.
- public SList<unowned TextTag> get_toggled_tags (bool toggled_on)
Returns a list of `GtkTextTag` that are toggled on or off at this point.
- public int get_visible_line_index ()
Returns the number of bytes from the start of the line to the given this, not counting bytes that are invisible due to tags with the “invisible” flag toggled on.
- public int get_visible_line_offset ()
Returns the offset in characters from the start of the line to the given this, not counting characters that are invisible due to tags with the “invisible” flag toggled on.
- public string get_visible_slice (TextIter end)
Returns visible text in the given range.
- public string get_visible_text (TextIter end)
Returns visible text in the given range.
- public bool has_tag (TextTag tag)
Returns true if this points to a character that is part of a range tagged with
tag
. - public bool in_range (TextIter start, TextIter end)
Checks whether this falls in the range [
start
,end
). - public bool inside_sentence ()
Determines whether this is inside a sentence (as opposed to in between two sentences, e.
- public bool inside_word ()
Determines whether the character pointed by this is part of a natural-language word (as opposed to say inside some whitespace).
- public bool is_cursor_position ()
Determine if this is at a cursor position.
- public bool is_end ()
Returns true if this is the end iterator.
- public bool is_start ()
Returns true if this is the first iterator in the buffer.
- public void order (ref TextIter second)
Swaps the value of this and
second
ifsecond
comes before this in the buffer. - public void set_line (int line_number)
Moves iterator this to the start of the line
line_number
. - public void set_line_index (int byte_on_line)
Same as [method@Gtk.
- public void set_line_offset (int char_on_line)
Moves this within a line, to a new character (not byte) offset.
- public void set_offset (int char_offset)
Sets this to point to
char_offset
. - public void set_visible_line_index (int byte_on_line)
Like [method@Gtk.
- public void set_visible_line_offset (int char_on_line)
Like [method@Gtk.
- public bool starts_line ()
Returns true if this begins a paragraph.
- public bool starts_sentence ()
Determines whether this begins a sentence.
- public bool starts_tag (TextTag? tag)
Returns true if
tag
is toggled on at exactly this point. - public bool starts_word ()
Determines whether this begins a natural-language word.
- public bool toggles_tag (TextTag? tag)
Gets whether a range with
tag
applied to it begins or ends at this.