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
You may wish to begin by reading the [text widget conceptual overview](TextWidget.
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: gtk+-3.0
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 (ifcount
would move past the start or end of the buffer, moves to the start or end of the buffer). - public bool backward_cursor_position ()
Like forward_cursor_position, but moves backward.
- public bool backward_cursor_positions (int count)
Moves up to
count
cursor positions. - public bool backward_find_char (TextCharPredicate pred, TextIter? limit)
Same as forward_find_char, but goes backward from this.
- 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 (ifcount
would move past the start or end of the buffer, moves to the start or end of the buffer). - public bool backward_search (string str, TextSearchFlags flags, out TextIter match_start, out TextIter match_end, TextIter? limit)
Same as forward_search, but moves backward.
- public bool backward_sentence_start ()
Moves backward to the previous sentence start; if this is already at the start of a sentence, moves backward to the next one.
- public bool backward_sentence_starts (int count)
Calls backward_sentence_start up to
count
times, or until it returns false. - public bool backward_to_tag_toggle (TextTag? tag)
Moves backward to the next toggle (on or off) of the TextTag
tag
, or to the next toggle of any tag iftag
is null. - public bool backward_visible_cursor_position ()
Moves this forward 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 (ifcount
would move past the start or end of the buffer, moves to the start or end of the buffer). - public bool backward_visible_word_start ()
Moves backward to the previous visible word start.
- public bool backward_visible_word_starts (int count)
Calls backward_visible_word_start up to
count
times. - public bool backward_word_start ()
Moves backward to the previous word start.
- public bool backward_word_starts (int count)
Calls backward_word_start up to
count
times. - public bool begins_tag (TextTag? tag)
Returns true if
tag
is toggled on at exactly this point. - 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 (delimiters will be either a newline, a carriage return, a carriage return followed by a newline, or a Unicode paragraph separator character).
- 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 (ifcount
would move past the start or end of the buffer, moves to the start or end of the buffer). - 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 (ifcount
would move past the start or end of the buffer, moves to the start or end of the buffer). - 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 forward_sentence_end
count
times (or until forward_sentence_end returns false ). - 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, which will be either a newline, a carriage return, a carriage return/newline in sequence, or the Unicode paragraph separator character.
- public bool forward_to_tag_toggle (TextTag? tag)
Moves forward to the next toggle (on or off) of the TextTag
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 (ifcount
would move past the start or end of the buffer, moves to the start or end of the buffer). - public bool forward_visible_word_end ()
Moves forward to the next visible word end.
- public bool forward_visible_word_ends (int count)
Calls forward_visible_word_end up to
count
times. - public bool forward_word_end ()
Moves forward to the next word end.
- public bool forward_word_ends (int count)
Calls forward_word_end up to
count
times. - public void free ()
Free an iterator allocated on the heap.
- public bool get_attributes (TextAttributes values)
Computes the effect of any tags applied to this spot in the text.
- public unowned TextBuffer get_buffer ()
Returns the TextBuffer 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 (with no new reference count added).
- public Language get_language ()
A convenience wrapper around get_attributes, which 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 TextMark at this location.
- public int get_offset ()
Returns the character offset of an iterator.
- public unowned Pixbuf get_pixbuf ()
If the element at this is a pixbuf, the pixbuf is returned (with no new reference count added).
- 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 (highest-priority tags are last).
- 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 TextTag 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)
Like get_slice, but invisible text is not included.
- public string get_visible_text (TextIter end)
Like get_text , but invisible text is not included.
- 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 ()
See forward_cursor_position or LogAttr or @break for details on what a cursor position is.
- public bool is_end ()
Returns true if this is the end iterator, i.
- public bool is_start ()
Returns true if this is the first iterator in the buffer, that is if this has a character offset of 0.
- 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 set_line_offset, but works with a byte index.
- 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 set_line_index, but the index is in visible bytes, i.
- public void set_visible_line_offset (int char_on_line)
Like set_line_offset, but the offset is in visible characters, i.
- public bool starts_line ()
Returns true if this begins a paragraph, i.
- 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)
This is equivalent to ( starts_tag || ends_tag), i.