1
2@c %start of fragment
3
4@deftp Class <gtk-text-iter>
5Derives from @code{<gboxed>}.
6
7This class defines no direct slots.
8
9@end deftp
10
11@deffn Function gtk-text-iter-get-buffer  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-buffer>})
12Returns the @code{<gtk-text-buffer>} this iterator is associated with.
13
14@table @var
15@item iter
16an iterator
17
18@item ret
19the buffer
20
21@end table
22
23@end deffn
24
25@deffn Function gtk-text-iter-copy  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-iter>})
26Creates a dynamically-allocated copy of an iterator. This function is not useful
27in applications, because iterators can be copied with a simple assignment
28(@samp{GtkTextIter i = j;}). The function is used by language bindings.
29
30@table @var
31@item iter
32an iterator
33
34@item ret
35a copy of the @var{iter}, free with @code{gtk-text-iter-free}
36
37@end table
38
39@end deffn
40
41@deffn Function gtk-text-iter-get-offset  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
42Returns the character offset of an iterator. Each character in a
43@code{<gtk-text-buffer>} has an offset, starting with 0 for the first character
44in the buffer. Use @code{gtk-text-buffer-get-iter-at-offset} to convert an
45offset back into an iterator.
46
47@table @var
48@item iter
49an iterator
50
51@item ret
52a character offset
53
54@end table
55
56@end deffn
57
58@deffn Function gtk-text-iter-get-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
59Returns the line number containing the iterator. Lines in a
60@code{<gtk-text-buffer>} are numbered beginning with 0 for the first line in the
61buffer.
62
63@table @var
64@item iter
65an iterator
66
67@item ret
68a line number
69
70@end table
71
72@end deffn
73
74@deffn Function gtk-text-iter-get-line-offset  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
75Returns the character offset of the iterator, counting from the start of a
76newline-terminated line. The first character on the line has offset 0.
77
78@table @var
79@item iter
80an iterator
81
82@item ret
83offset from start of line
84
85@end table
86
87@end deffn
88
89@deffn Function gtk-text-iter-get-line-index  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
90Returns the byte index of the iterator, counting from the start of a
91newline-terminated line. Remember that @code{<gtk-text-buffer>} encodes text in
92UTF-8, and that characters can require a variable number of bytes to represent.
93
94@table @var
95@item iter
96an iterator
97
98@item ret
99distance from start of line, in bytes
100
101@end table
102
103@end deffn
104
105@deffn Function gtk-text-iter-get-char  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{unsigned-int32})
106Returns the Unicode character at this iterator. (Equivalent to operator* on a
107C++ iterator.) If the element at this iterator is a non-character element, such
108as an image embedded in the buffer, the Unicode "unknown" character 0xFFFC is
109returned. If invoked on the end iterator, zero is returned; zero is not a valid
110Unicode character. So you can write a loop which ends when
111@code{gtk-text-iter-get-char} returns 0.
112
113@table @var
114@item iter
115an iterator
116
117@item ret
118a Unicode character, or 0 if @var{iter} is not dereferenceable
119
120@end table
121
122@end deffn
123
124@deffn Function gtk-text-iter-get-slice  (self@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{mchars})
125Returns the text in the given range. A "slice" is an array of characters encoded
126in UTF-8 format, including the Unicode "unknown" character 0xFFFC for iterable
127non-character elements in the buffer, such as images. Because images are encoded
128in the slice, byte and character offsets in the returned array will correspond
129to byte offsets in the text buffer. Note that 0xFFFC can occur in normal text as
130well, so it is not a reliable indicator that a pixbuf or widget is in the
131buffer.
132
133@table @var
134@item start
135iterator at start of a range
136
137@item end
138iterator at end of a range
139
140@item ret
141slice of text from the buffer
142
143@end table
144
145@end deffn
146
147@deffn Function gtk-text-iter-get-text  (self@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{mchars})
148Returns @emph{text} in the given range. If the range contains non-text elements
149such as images, the character and byte offsets in the returned string will not
150correspond to character and byte offsets in the buffer. If you want offsets to
151correspond, see @code{gtk-text-iter-get-slice}.
152
153@table @var
154@item start
155iterator at start of a range
156
157@item end
158iterator at end of a range
159
160@item ret
161array of characters from the buffer
162
163@end table
164
165@end deffn
166
167@deffn Function gtk-text-iter-get-visible-slice  (self@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{mchars})
168Like @code{gtk-text-iter-get-slice}, but invisible text is not included.
169Invisible text is usually invisible because a @code{<gtk-text-tag>} with the
170"invisible" attribute turned on has been applied to it.
171
172@table @var
173@item start
174iterator at start of range
175
176@item end
177iterator at end of range
178
179@item ret
180slice of text from the buffer
181
182@end table
183
184@end deffn
185
186@deffn Function gtk-text-iter-get-visible-text  (self@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{mchars})
187Like @code{gtk-text-iter-get-text}, but invisible text is not included.
188Invisible text is usually invisible because a @code{<gtk-text-tag>} with the
189"invisible" attribute turned on has been applied to it.
190
191@table @var
192@item start
193iterator at start of range
194
195@item end
196iterator at end of range
197
198@item ret
199string containing visible text in the range
200
201@end table
202
203@end deffn
204
205@deffn Function gtk-text-iter-get-pixbuf  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{<gdk-pixbuf>})
206If the element at @var{iter} is a pixbuf, the pixbuf is returned (with no new
207reference count added). Otherwise, @samp{@code{#f}} is returned.
208
209@table @var
210@item iter
211an iterator
212
213@item ret
214the pixbuf at @var{iter}
215
216@end table
217
218@end deffn
219
220@deffn Function gtk-text-iter-get-marks  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{gslist-of})
221Returns a list of all @code{<gtk-text-mark>} at this location. Because marks are
222not iterable (they don't take up any "space" in the buffer, they are just marks
223in between iterable locations), multiple marks can exist in the same place. The
224returned list is not in any meaningful order.
225
226@table @var
227@item iter
228an iterator
229
230@item ret
231list of @code{<gtk-text-mark>}
232
233@end table
234
235@end deffn
236
237@deffn Function gtk-text-iter-get-toggled-tags  (self@tie{}@code{<gtk-text-iter>}) (toggled_on@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{gslist-of})
238Returns a list of @code{<gtk-text-tag>} that are toggled on or off at this
239point. (If @var{toggled-on} is @samp{@code{#t}}, the list contains tags that are
240toggled on.) If a tag is toggled on at @var{iter}, then some non-empty range of
241characters following @var{iter} has that tag applied to it. If a tag is toggled
242off, then some non-empty range following @var{iter} does @emph{not} have the tag
243applied to it.
244
245@table @var
246@item iter
247an iterator
248
249@item toggled-on
250@samp{@code{#t}} to get toggled-on tags
251
252@item ret
253tags toggled at this point
254
255@end table
256
257@end deffn
258
259@deffn Function gtk-text-iter-get-child-anchor  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-child-anchor>})
260If the location at @var{iter} contains a child anchor, the anchor is returned
261(with no new reference count added). Otherwise, @samp{@code{#f}} is returned.
262
263@table @var
264@item iter
265an iterator
266
267@item ret
268the anchor at @var{iter}
269
270@end table
271
272@end deffn
273
274@deffn Function gtk-text-iter-begins-tag  (self@tie{}@code{<gtk-text-iter>}) (tag@tie{}@code{<gtk-text-tag>}) @result{}@tie{} (ret@tie{}@code{bool})
275Returns @samp{@code{#t}} if @var{tag} is toggled on at exactly this point. If
276@var{tag} is @samp{@code{#f}}, returns @samp{@code{#t}} if any tag is toggled on
277at this point. Note that the @code{gtk-text-iter-begins-tag} returns
278@samp{@code{#t}} if @var{iter} is the @emph{start} of the tagged range;
279@code{gtk-text-iter-has-tag} tells you whether an iterator is @emph{within} a
280tagged range.
281
282@table @var
283@item iter
284an iterator
285
286@item tag
287a @code{<gtk-text-tag>}, or @samp{@code{#f}}
288
289@item ret
290whether @var{iter} is the start of a range tagged with @var{tag}
291
292@end table
293
294@end deffn
295
296@deffn Function gtk-text-iter-ends-tag  (self@tie{}@code{<gtk-text-iter>}) (tag@tie{}@code{<gtk-text-tag>}) @result{}@tie{} (ret@tie{}@code{bool})
297Returns @samp{@code{#t}} if @var{tag} is toggled off at exactly this point. If
298@var{tag} is @samp{@code{#f}}, returns @samp{@code{#t}} if any tag is toggled
299off at this point. Note that the @code{gtk-text-iter-ends-tag} returns
300@samp{@code{#t}} if @var{iter} is the @emph{end} of the tagged range;
301@code{gtk-text-iter-has-tag} tells you whether an iterator is @emph{within} a
302tagged range.
303
304@table @var
305@item iter
306an iterator
307
308@item tag
309a @code{<gtk-text-tag>}, or @samp{@code{#f}}
310
311@item ret
312whether @var{iter} is the end of a range tagged with @var{tag}
313
314@end table
315
316@end deffn
317
318@deffn Function gtk-text-iter-toggles-tag  (self@tie{}@code{<gtk-text-iter>}) (tag@tie{}@code{<gtk-text-tag>}) @result{}@tie{} (ret@tie{}@code{bool})
319This is equivalent to (@code{gtk-text-iter-begins-tag} ||
320@code{gtk-text-iter-ends-tag}), i.e. it tells you whether a range with @var{tag}
321applied to it begins @emph{or} ends at @var{iter}.
322
323@table @var
324@item iter
325an iterator
326
327@item tag
328a @code{<gtk-text-tag>}, or @samp{@code{#f}}
329
330@item ret
331whether @var{tag} is toggled on or off at @var{iter}
332
333@end table
334
335@end deffn
336
337@deffn Function gtk-text-iter-has-tag  (self@tie{}@code{<gtk-text-iter>}) (tag@tie{}@code{<gtk-text-tag>}) @result{}@tie{} (ret@tie{}@code{bool})
338Returns @samp{@code{#t}} if @var{iter} is within a range tagged with @var{tag}.
339
340@table @var
341@item iter
342an iterator
343
344@item tag
345a @code{<gtk-text-tag>}
346
347@item ret
348whether @var{iter} is tagged with @var{tag}
349
350@end table
351
352@end deffn
353
354@deffn Function gtk-text-iter-get-tags  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{gslist-of})
355Returns a list of tags that apply to @var{iter}, in ascending order of priority
356(highest-priority tags are last). The @code{<gtk-text-tag>} in the list don't
357have a reference added, but you have to free the list itself.
358
359@table @var
360@item iter
361a @code{<gtk-text-iter>}
362
363@item ret
364list of @code{<gtk-text-tag>}
365
366@end table
367
368@end deffn
369
370@deffn Function gtk-text-iter-editable  (self@tie{}@code{<gtk-text-iter>}) (default_setting@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{bool})
371Returns whether the character at @var{iter} is within an editable region of
372text. Non-editable text is "locked" and can't be changed by the user via
373@code{<gtk-text-view>}. This function is simply a convenience wrapper around
374@code{gtk-text-iter-get-attributes}. If no tags applied to this text affect
375editability, @var{default-setting} will be returned.
376
377You don't want to use this function to decide whether text can be inserted at
378@var{iter}, because for insertion you don't want to know whether the char at
379@var{iter} is inside an editable range, you want to know whether a new character
380inserted at @var{iter} would be inside an editable range. Use
381@code{gtk-text-iter-can-insert} to handle this case.
382
383@table @var
384@item iter
385an iterator
386
387@item default-setting
388@samp{@code{#t}} if text is editable by default
389
390@item ret
391whether @var{iter} is inside an editable range
392
393@end table
394
395@end deffn
396
397@deffn Function gtk-text-iter-can-insert  (self@tie{}@code{<gtk-text-iter>}) (default_editability@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{bool})
398Considering the default editability of the buffer, and tags that affect
399editability, determines whether text inserted at @var{iter} would be editable.
400If text inserted at @var{iter} would be editable then the user should be allowed
401to insert text at @var{iter}. @code{gtk-text-buffer-insert-interactive} uses
402this function to decide whether insertions are allowed at a given position.
403
404@table @var
405@item iter
406an iterator
407
408@item default-editability
409@samp{@code{#t}} if text is editable by default
410
411@item ret
412whether text inserted at @var{iter} would be editable
413
414@end table
415
416@end deffn
417
418@deffn Function gtk-text-iter-starts-word  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
419Determines whether @var{iter} begins a natural-language word. Word breaks are
420determined by Pango and should be correct for nearly any language (if not, the
421correct fix would be to the Pango word break algorithms).
422
423@table @var
424@item iter
425a @code{<gtk-text-iter>}
426
427@item ret
428@samp{@code{#t}} if @var{iter} is at the start of a word
429
430@end table
431
432@end deffn
433
434@deffn Function gtk-text-iter-ends-word  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
435Determines whether @var{iter} ends a natural-language word. Word breaks are
436determined by Pango and should be correct for nearly any language (if not, the
437correct fix would be to the Pango word break algorithms).
438
439@table @var
440@item iter
441a @code{<gtk-text-iter>}
442
443@item ret
444@samp{@code{#t}} if @var{iter} is at the end of a word
445
446@end table
447
448@end deffn
449
450@deffn Function gtk-text-iter-inside-word  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
451Determines whether @var{iter} is inside a natural-language word (as opposed to
452say inside some whitespace). Word breaks are determined by Pango and should be
453correct for nearly any language (if not, the correct fix would be to the Pango
454word break algorithms).
455
456@table @var
457@item iter
458a @code{<gtk-text-iter>}
459
460@item ret
461@samp{@code{#t}} if @var{iter} is inside a word
462
463@end table
464
465@end deffn
466
467@deffn Function gtk-text-iter-starts-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
468Returns @samp{@code{#t}} if @var{iter} begins a paragraph, i.e. if
469@code{gtk-text-iter-get-line-offset} would return 0. However this function is
470potentially more efficient than @code{gtk-text-iter-get-line-offset} because it
471doesn't have to compute the offset, it just has to see whether it's 0.
472
473@table @var
474@item iter
475an iterator
476
477@item ret
478whether @var{iter} begins a line
479
480@end table
481
482@end deffn
483
484@deffn Function gtk-text-iter-ends-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
485Returns @samp{@code{#t}} if @var{iter} points to the start of the paragraph
486delimiter characters for a line (delimiters will be either a newline, a carriage
487return, a carriage return followed by a newline, or a Unicode paragraph
488separator character). Note that an iterator pointing to the \n of a \r\n pair
489will not be counted as the end of a line, the line ends before the \r. The end
490iterator is considered to be at the end of a line, even though there are no
491paragraph delimiter chars there.
492
493@table @var
494@item iter
495an iterator
496
497@item ret
498whether @var{iter} is at the end of a line
499
500@end table
501
502@end deffn
503
504@deffn Function gtk-text-iter-starts-sentence  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
505Determines whether @var{iter} begins a sentence. Sentence boundaries are
506determined by Pango and should be correct for nearly any language (if not, the
507correct fix would be to the Pango text boundary algorithms).
508
509@table @var
510@item iter
511a @code{<gtk-text-iter>}
512
513@item ret
514@samp{@code{#t}} if @var{iter} is at the start of a sentence.
515
516@end table
517
518@end deffn
519
520@deffn Function gtk-text-iter-ends-sentence  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
521Determines whether @var{iter} ends a sentence. Sentence boundaries are
522determined by Pango and should be correct for nearly any language (if not, the
523correct fix would be to the Pango text boundary algorithms).
524
525@table @var
526@item iter
527a @code{<gtk-text-iter>}
528
529@item ret
530@samp{@code{#t}} if @var{iter} is at the end of a sentence.
531
532@end table
533
534@end deffn
535
536@deffn Function gtk-text-iter-inside-sentence  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
537Determines whether @var{iter} is inside a sentence (as opposed to in between two
538sentences, e.g. after a period and before the first letter of the next
539sentence). Sentence boundaries are determined by Pango and should be correct for
540nearly any language (if not, the correct fix would be to the Pango text boundary
541algorithms).
542
543@table @var
544@item iter
545a @code{<gtk-text-iter>}
546
547@item ret
548@samp{@code{#t}} if @var{iter} is inside a sentence.
549
550@end table
551
552@end deffn
553
554@deffn Function gtk-text-iter-is-cursor-position  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
555See @code{gtk-text-iter-forward-cursor-position} or @code{<pango-log-attr>} or
556@code{pango-break} for details on what a cursor position is.
557
558@table @var
559@item iter
560a @code{<gtk-text-iter>}
561
562@item ret
563@samp{@code{#t}} if the cursor can be placed at @var{iter}
564
565@end table
566
567@end deffn
568
569@deffn Function gtk-text-iter-get-chars-in-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
570Returns the number of characters in the line containing @var{iter}, including
571the paragraph delimiters.
572
573@table @var
574@item iter
575an iterator
576
577@item ret
578number of characters in the line
579
580@end table
581
582@end deffn
583
584@deffn Function gtk-text-iter-get-bytes-in-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
585Returns the number of bytes in the line containing @var{iter}, including the
586paragraph delimiters.
587
588@table @var
589@item iter
590an iterator
591
592@item ret
593number of bytes in the line
594
595@end table
596
597@end deffn
598
599@deffn Function gtk-text-iter-get-attributes  (self@tie{}@code{<gtk-text-iter>}) (values@tie{}@code{<gtk-text-attributes>}) @result{}@tie{} (ret@tie{}@code{bool})
600Computes the effect of any tags applied to this spot in the text. The
601@var{values} parameter should be initialized to the default settings you wish to
602use if no tags are in effect. You'd typically obtain the defaults from
603@code{gtk-text-view-get-default-attributes}.
604
605@code{gtk-text-iter-get-attributes} will modify @var{values}, applying the
606effects of any tags present at @var{iter}. If any tags affected @var{values},
607the function returns @samp{@code{#t}}.
608
609@table @var
610@item iter
611an iterator
612
613@item values
614a @code{<gtk-text-attributes>} to be filled in
615
616@item ret
617@samp{@code{#t}} if @var{values} was modified
618
619@end table
620
621@end deffn
622
623@deffn Function gtk-text-iter-get-language  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{<pango-language>})
624A convenience wrapper around @code{gtk-text-iter-get-attributes}, which returns
625the language in effect at @var{iter}. If no tags affecting language apply to
626@var{iter}, the return value is identical to that of
627@code{gtk-get-default-language}.
628
629@table @var
630@item iter
631an iterator
632
633@item ret
634language in effect at @var{iter}
635
636@end table
637
638@end deffn
639
640@deffn Function gtk-text-iter-is-end  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
641Returns @samp{@code{#t}} if @var{iter} is the end iterator, i.e. one past the
642last dereferenceable iterator in the buffer. @code{gtk-text-iter-is-end} is the
643most efficient way to check whether an iterator is the end iterator.
644
645@table @var
646@item iter
647an iterator
648
649@item ret
650whether @var{iter} is the end iterator
651
652@end table
653
654@end deffn
655
656@deffn Function gtk-text-iter-is-start  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
657Returns @samp{@code{#t}} if @var{iter} is the first iterator in the buffer, that
658is if @var{iter} has a character offset of 0.
659
660@table @var
661@item iter
662an iterator
663
664@item ret
665whether @var{iter} is the first in the buffer
666
667@end table
668
669@end deffn
670
671@deffn Function gtk-text-iter-forward-char  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
672Moves @var{iter} forward by one character offset. Note that images embedded in
673the buffer occupy 1 character slot, so @code{gtk-text-iter-forward-char} may
674actually move onto an image instead of a character, if you have images in your
675buffer. If @var{iter} is the end iterator or one character before it, @var{iter}
676will now point at the end iterator, and @code{gtk-text-iter-forward-char}
677returns @samp{@code{#f}} for convenience when writing loops.
678
679@table @var
680@item iter
681an iterator
682
683@item ret
684whether @var{iter} moved and is dereferenceable
685
686@end table
687
688@end deffn
689
690@deffn Function gtk-text-iter-backward-char  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
691Moves backward by one character offset. Returns @samp{@code{#t}} if movement was
692possible; if @var{iter} was the first in the buffer (character offset 0),
693@code{gtk-text-iter-backward-char} returns @samp{@code{#f}} for convenience when
694writing loops.
695
696@table @var
697@item iter
698an iterator
699
700@item ret
701whether movement was possible
702
703@end table
704
705@end deffn
706
707@deffn Function gtk-text-iter-forward-chars  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
708Moves @var{count} characters if possible (if @var{count} would move past the
709start or end of the buffer, moves to the start or end of the buffer). The return
710value indicates whether the new position of @var{iter} is different from its
711original position, and dereferenceable (the last iterator in the buffer is not
712dereferenceable). If @var{count} is 0, the function does nothing and returns
713@samp{@code{#f}}.
714
715@table @var
716@item iter
717an iterator
718
719@item count
720number of characters to move, may be negative
721
722@item ret
723whether @var{iter} moved and is dereferenceable
724
725@end table
726
727@end deffn
728
729@deffn Function gtk-text-iter-backward-chars  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
730Moves @var{count} characters backward, if possible (if @var{count} would move
731past the start or end of the buffer, moves to the start or end of the buffer).
732The return value indicates whether the iterator moved onto a dereferenceable
733position; if the iterator didn't move, or moved onto the end iterator, then
734@samp{@code{#f}} is returned. If @var{count} is 0, the function does nothing and
735returns @samp{@code{#f}}.
736
737@table @var
738@item iter
739an iterator
740
741@item count
742number of characters to move
743
744@item ret
745whether @var{iter} moved and is dereferenceable
746
747@end table
748
749@end deffn
750
751@deffn Function gtk-text-iter-forward-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
752Moves @var{iter} to the start of the next line. Returns @samp{@code{#t}} if
753there was a next line to move to, and @samp{@code{#f}} if @var{iter} was simply
754moved to the end of the buffer and is now not dereferenceable, or if @var{iter}
755was already at the end of the buffer.
756
757@table @var
758@item iter
759an iterator
760
761@item ret
762whether @var{iter} can be dereferenced
763
764@end table
765
766@end deffn
767
768@deffn Function gtk-text-iter-backward-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
769Moves @var{iter} to the start of the previous line. Returns @samp{@code{#t}} if
770@var{iter} could be moved; i.e. if @var{iter} was at character offset 0, this
771function returns @samp{@code{#f}}. Therefore if @var{iter} was already on line
7720, but not at the start of the line, @var{iter} is snapped to the start of the
773line and the function returns @samp{@code{#t}}. (Note that this implies that in
774a loop calling this function, the line number may not change on every iteration,
775if your first iteration is on line 0.)
776
777@table @var
778@item iter
779an iterator
780
781@item ret
782whether @var{iter} moved
783
784@end table
785
786@end deffn
787
788@deffn Function gtk-text-iter-forward-lines  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
789Moves @var{count} lines forward, if possible (if @var{count} would move past the
790start or end of the buffer, moves to the start or end of the buffer). The return
791value indicates whether the iterator moved onto a dereferenceable position; if
792the iterator didn't move, or moved onto the end iterator, then @samp{@code{#f}}
793is returned. If @var{count} is 0, the function does nothing and returns
794@samp{@code{#f}}. If @var{count} is negative, moves backward by 0 - @var{count}
795lines.
796
797@table @var
798@item iter
799a @code{<gtk-text-iter>}
800
801@item count
802number of lines to move forward
803
804@item ret
805whether @var{iter} moved and is dereferenceable
806
807@end table
808
809@end deffn
810
811@deffn Function gtk-text-iter-backward-lines  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
812Moves @var{count} lines backward, if possible (if @var{count} would move past
813the start or end of the buffer, moves to the start or end of the buffer). The
814return value indicates whether the iterator moved onto a dereferenceable
815position; if the iterator didn't move, or moved onto the end iterator, then
816@samp{@code{#f}} is returned. If @var{count} is 0, the function does nothing and
817returns @samp{@code{#f}}. If @var{count} is negative, moves forward by 0 -
818@var{count} lines.
819
820@table @var
821@item iter
822a @code{<gtk-text-iter>}
823
824@item count
825number of lines to move backward
826
827@item ret
828whether @var{iter} moved and is dereferenceable
829
830@end table
831
832@end deffn
833
834@deffn Function gtk-text-iter-forward-word-ends  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
835Calls @code{gtk-text-iter-forward-word-end} up to @var{count} times.
836
837@table @var
838@item iter
839a @code{<gtk-text-iter>}
840
841@item count
842number of times to move
843
844@item ret
845@samp{@code{#t}} if @var{iter} moved and is not the end iterator
846
847@end table
848
849@end deffn
850
851@deffn Function gtk-text-iter-backward-word-starts  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
852Calls @code{gtk-text-iter-backward-word-start} up to @var{count} times.
853
854@table @var
855@item iter
856a @code{<gtk-text-iter>}
857
858@item count
859number of times to move
860
861@item ret
862@samp{@code{#t}} if @var{iter} moved and is not the end iterator
863
864@end table
865
866@end deffn
867
868@deffn Function gtk-text-iter-forward-word-end  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
869Moves forward to the next word end. (If @var{iter} is currently on a word end,
870moves forward to the next one after that.) Word breaks are determined by Pango
871and should be correct for nearly any language (if not, the correct fix would be
872to the Pango word break algorithms).
873
874@table @var
875@item iter
876a @code{<gtk-text-iter>}
877
878@item ret
879@samp{@code{#t}} if @var{iter} moved and is not the end iterator
880
881@end table
882
883@end deffn
884
885@deffn Function gtk-text-iter-backward-word-start  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
886Moves backward to the previous word start. (If @var{iter} is currently on a word
887start, moves backward to the next one after that.) Word breaks are determined by
888Pango and should be correct for nearly any language (if not, the correct fix
889would be to the Pango word break algorithms).
890
891@table @var
892@item iter
893a @code{<gtk-text-iter>}
894
895@item ret
896@samp{@code{#t}} if @var{iter} moved and is not the end iterator
897
898@end table
899
900@end deffn
901
902@deffn Function gtk-text-iter-forward-sentence-end  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
903Moves forward to the next sentence end. (If @var{iter} is at the end of a
904sentence, moves to the next end of sentence.) Sentence boundaries are determined
905by Pango and should be correct for nearly any language (if not, the correct fix
906would be to the Pango text boundary algorithms).
907
908@table @var
909@item iter
910a @code{<gtk-text-iter>}
911
912@item ret
913@samp{@code{#t}} if @var{iter} moved and is not the end iterator
914
915@end table
916
917@end deffn
918
919@deffn Function gtk-text-iter-forward-sentence-ends  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
920Calls @code{gtk-text-iter-forward-sentence-end}@var{count} times (or until
921@code{gtk-text-iter-forward-sentence-end} returns @samp{@code{#f}}). If
922@var{count} is negative, moves backward instead of forward.
923
924@table @var
925@item iter
926a @code{<gtk-text-iter>}
927
928@item count
929number of sentences to move
930
931@item ret
932@samp{@code{#t}} if @var{iter} moved and is not the end iterator
933
934@end table
935
936@end deffn
937
938@deffn Function gtk-text-iter-forward-visible-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
939Moves @var{iter} to the start of the next visible line. Returns @samp{@code{#t}}
940if there was a next line to move to, and @samp{@code{#f}} if @var{iter} was
941simply moved to the end of the buffer and is now not dereferenceable, or if
942@var{iter} was already at the end of the buffer.
943
944@table @var
945@item iter
946an iterator
947
948@item ret
949whether @var{iter} can be dereferenced
950
951@end table
952
953Since 2.8
954
955@end deffn
956
957@deffn Function gtk-text-iter-backward-visible-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
958Moves @var{iter} to the start of the previous visible line. Returns
959@samp{@code{#t}} if @var{iter} could be moved; i.e. if @var{iter} was at
960character offset 0, this function returns @samp{@code{#f}}. Therefore if
961@var{iter} was already on line 0, but not at the start of the line, @var{iter}
962is snapped to the start of the line and the function returns @samp{@code{#t}}.
963(Note that this implies that in a loop calling this function, the line number
964may not change on every iteration, if your first iteration is on line 0.)
965
966@table @var
967@item iter
968an iterator
969
970@item ret
971whether @var{iter} moved
972
973@end table
974
975Since 2.8
976
977@end deffn
978
979@deffn Function gtk-text-iter-forward-visible-lines  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
980Moves @var{count} visible lines forward, if possible (if @var{count} would move
981past the start or end of the buffer, moves to the start or end of the buffer).
982The return value indicates whether the iterator moved onto a dereferenceable
983position; if the iterator didn't move, or moved onto the end iterator, then
984@samp{@code{#f}} is returned. If @var{count} is 0, the function does nothing and
985returns @samp{@code{#f}}. If @var{count} is negative, moves backward by 0 -
986@var{count} lines.
987
988@table @var
989@item iter
990a @code{<gtk-text-iter>}
991
992@item count
993number of lines to move forward
994
995@item ret
996whether @var{iter} moved and is dereferenceable
997
998@end table
999
1000Since 2.8
1001
1002@end deffn
1003
1004@deffn Function gtk-text-iter-set-offset  (self@tie{}@code{<gtk-text-iter>}) (char_offset@tie{}@code{int})
1005Sets @var{iter} to point to @var{char-offset}. @var{char-offset} counts from the
1006start of the entire text buffer, starting with 0.
1007
1008@table @var
1009@item iter
1010a @code{<gtk-text-iter>}
1011
1012@item char-offset
1013a character number
1014
1015@end table
1016
1017@end deffn
1018
1019@deffn Function gtk-text-iter-set-line  (self@tie{}@code{<gtk-text-iter>}) (line_number@tie{}@code{int})
1020Moves iterator @var{iter} to the start of the line @var{line-number}. If
1021@var{line-number} is negative or larger than the number of lines in the buffer,
1022moves @var{iter} to the start of the last line in the buffer.
1023
1024@table @var
1025@item iter
1026a @code{<gtk-text-iter>}
1027
1028@item line-number
1029line number (counted from 0)
1030
1031@end table
1032
1033@end deffn
1034
1035@deffn Function gtk-text-iter-set-line-offset  (self@tie{}@code{<gtk-text-iter>}) (char_on_line@tie{}@code{int})
1036Moves @var{iter} within a line, to a new @emph{character} (not byte) offset. The
1037given character offset must be less than or equal to the number of characters in
1038the line; if equal, @var{iter} moves to the start of the next line. See
1039@code{gtk-text-iter-set-line-index} if you have a byte index rather than a
1040character offset.
1041
1042@table @var
1043@item iter
1044a @code{<gtk-text-iter>}
1045
1046@item char-on-line
1047a character offset relative to the start of @var{iter}'s current line
1048
1049@end table
1050
1051@end deffn
1052
1053@deffn Function gtk-text-iter-set-line-index  (self@tie{}@code{<gtk-text-iter>}) (byte_on_line@tie{}@code{int})
1054Same as @code{gtk-text-iter-set-line-offset}, but works with a @emph{byte}
1055index. The given byte index must be at the start of a character, it can't be in
1056the middle of a UTF-8 encoded character.
1057
1058@table @var
1059@item iter
1060a @code{<gtk-text-iter>}
1061
1062@item byte-on-line
1063a byte index relative to the start of @var{iter}'s current line
1064
1065@end table
1066
1067@end deffn
1068
1069@deffn Function gtk-text-iter-forward-to-end  (self@tie{}@code{<gtk-text-iter>})
1070Moves @var{iter} forward to the "end iterator," which points one past the last
1071valid character in the buffer. @code{gtk-text-iter-get-char} called on the end
1072iterator returns 0, which is convenient for writing loops.
1073
1074@table @var
1075@item iter
1076a @code{<gtk-text-iter>}
1077
1078@end table
1079
1080@end deffn
1081
1082@deffn Function gtk-text-iter-forward-to-line-end  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
1083Moves the iterator to point to the paragraph delimiter characters, which will be
1084either a newline, a carriage return, a carriage return/newline in sequence, or
1085the Unicode paragraph separator character. If the iterator is already at the
1086paragraph delimiter characters, moves to the paragraph delimiter characters for
1087the next line. If @var{iter} is on the last line in the buffer, which does not
1088end in paragraph delimiters, moves to the end iterator (end of the last line),
1089and returns @samp{@code{#f}}.
1090
1091@table @var
1092@item iter
1093a @code{<gtk-text-iter>}
1094
1095@item ret
1096@samp{@code{#t}} if we moved and the new location is not the end iterator
1097
1098@end table
1099
1100@end deffn
1101
1102@deffn Function gtk-text-iter-forward-to-tag-toggle  (self@tie{}@code{<gtk-text-iter>}) (tag@tie{}@code{<gtk-text-tag>}) @result{}@tie{} (ret@tie{}@code{bool})
1103Moves forward to the next toggle (on or off) of the
1104@code{<gtk-text-tag>}@var{tag}, or to the next toggle of any tag if @var{tag} is
1105@samp{@code{#f}}. If no matching tag toggles are found, returns
1106@samp{@code{#f}}, otherwise @samp{@code{#t}}. Does not return toggles located at
1107@var{iter}, only toggles after @var{iter}. Sets @var{iter} to the location of
1108the toggle, or to the end of the buffer if no toggle is found.
1109
1110@table @var
1111@item iter
1112a @code{<gtk-text-iter>}
1113
1114@item tag
1115a @code{<gtk-text-tag>}, or @samp{@code{#f}}
1116
1117@item ret
1118whether we found a tag toggle after @var{iter}
1119
1120@end table
1121
1122@end deffn
1123
1124@deffn Function gtk-text-iter-forward-search  (self@tie{}@code{<gtk-text-iter>}) (str@tie{}@code{mchars}) (flags@tie{}@code{<gtk-text-search-flags>}) (match_start@tie{}@code{<gtk-text-iter>}) (match_end@tie{}@code{<gtk-text-iter>}) (limit@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
1125Searches forward for @var{str}. Any match is returned by setting
1126@var{match-start} to the first character of the match and @var{match-end} to the
1127first character after the match. The search will not continue past @var{limit}.
1128Note that a search is a linear or O(n) operation, so you may wish to use
1129@var{limit} to avoid locking up your UI on large buffers.
1130
1131If the @code{<gtk-text-search-visible-only>} flag is present, the match may have
1132invisible text interspersed in @var{str}. i.e. @var{str} will be a
1133possibly-noncontiguous subsequence of the matched range. similarly, if you
1134specify @code{<gtk-text-search-text-only>}, the match may have pixbufs or child
1135widgets mixed inside the matched range. If these flags are not given, the match
1136must be exact; the special 0xFFFC character in @var{str} will match embedded
1137pixbufs or child widgets.
1138
1139@table @var
1140@item iter
1141start of search
1142
1143@item str
1144a search string
1145
1146@item flags
1147flags affecting how the search is done
1148
1149@item match-start
1150return location for start of match, or @samp{@code{#f}}
1151
1152@item match-end
1153return location for end of match, or @samp{@code{#f}}
1154
1155@item limit
1156bound for the search, or @samp{@code{#f}} for the end of the buffer
1157
1158@item ret
1159whether a match was found
1160
1161@end table
1162
1163@end deffn
1164
1165@deffn Function gtk-text-iter-backward-search  (self@tie{}@code{<gtk-text-iter>}) (str@tie{}@code{mchars}) (flags@tie{}@code{<gtk-text-search-flags>}) (match_start@tie{}@code{<gtk-text-iter>}) (match_end@tie{}@code{<gtk-text-iter>}) (limit@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
1166Same as @code{gtk-text-iter-forward-search}, but moves backward.
1167
1168@table @var
1169@item iter
1170a @code{<gtk-text-iter>} where the search begins
1171
1172@item str
1173search string
1174
1175@item flags
1176bitmask of flags affecting the search
1177
1178@item match-start
1179return location for start of match, or @samp{@code{#f}}
1180
1181@item match-end
1182return location for end of match, or @samp{@code{#f}}
1183
1184@item limit
1185location of last possible @var{match-start}, or @samp{@code{#f}} for start of
1186buffer
1187
1188@item ret
1189whether a match was found
1190
1191@end table
1192
1193@end deffn
1194
1195@deffn Function gtk-text-iter-equal  (self@tie{}@code{<gtk-text-iter>}) (rhs@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
1196Tests whether two iterators are equal, using the fastest possible mechanism.
1197This function is very fast; you can expect it to perform better than e.g.
1198getting the character offset for each iterator and comparing the offsets
1199yourself. Also, it's a bit faster than @code{gtk-text-iter-compare}.
1200
1201@table @var
1202@item lhs
1203a @code{<gtk-text-iter>}
1204
1205@item rhs
1206another @code{<gtk-text-iter>}
1207
1208@item ret
1209@samp{@code{#t}} if the iterators point to the same place in the buffer
1210
1211@end table
1212
1213@end deffn
1214
1215@deffn Function gtk-text-iter-compare  (self@tie{}@code{<gtk-text-iter>}) (rhs@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
1216A @code{qsort}-style function that returns negative if @var{lhs} is less than
1217@var{rhs}, positive if @var{lhs} is greater than @var{rhs}, and 0 if they're
1218equal. Ordering is in character offset order, i.e. the first character in the
1219buffer is less than the second character in the buffer.
1220
1221@table @var
1222@item lhs
1223a @code{<gtk-text-iter>}
1224
1225@item rhs
1226another @code{<gtk-text-iter>}
1227
1228@item ret
1229-1 if @var{lhs} is less than @var{rhs}, 1 if @var{lhs} is greater, 0 if they are
1230equal
1231
1232@end table
1233
1234@end deffn
1235
1236@deffn Function gtk-text-iter-in-range  (self@tie{}@code{<gtk-text-iter>}) (start@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
1237Checks whether @var{iter} falls in the range [@var{start}, @var{end}).
1238@var{start} and @var{end} must be in ascending order.
1239
1240@table @var
1241@item iter
1242a @code{<gtk-text-iter>}
1243
1244@item start
1245start of range
1246
1247@item end
1248end of range
1249
1250@item ret
1251@samp{@code{#t}} if @var{iter} is in the range
1252
1253@end table
1254
1255@end deffn
1256
1257@deffn Function gtk-text-iter-order  (self@tie{}@code{<gtk-text-iter>}) (second@tie{}@code{<gtk-text-iter>})
1258Swaps the value of @var{first} and @var{second} if @var{second} comes before
1259@var{first} in the buffer. That is, ensures that @var{first} and @var{second}
1260are in sequence. Most text buffer functions that take a range call this
1261automatically on your behalf, so there's no real reason to call it yourself in
1262those cases. There are some exceptions, such as @code{gtk-text-iter-in-range},
1263that expect a pre-sorted range.
1264
1265@table @var
1266@item first
1267a @code{<gtk-text-iter>}
1268
1269@item second
1270another @code{<gtk-text-iter>}
1271
1272@end table
1273
1274@end deffn
1275
1276
1277@c %end of fragment
1278