1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.TextIter;
26 
27 private import gdkpixbuf.Pixbuf;
28 private import glib.ListSG;
29 private import glib.Str;
30 private import gobject.ObjectG;
31 private import gtk.TextAttributes;
32 private import gtk.TextBuffer;
33 private import gtk.TextChildAnchor;
34 private import gtk.TextTag;
35 private import gtkc.gtk;
36 public  import gtkc.gtktypes;
37 private import gtkd.Loader;
38 private import pango.PgLanguage;
39 
40 
41 /**
42  * You may wish to begin by reading the
43  * [text widget conceptual overview][TextWidget]
44  * which gives an overview of all the objects and data
45  * types related to the text widget and how they work together.
46  */
47 public class TextIter
48 {
49 	/** the main Gtk struct */
50 	protected GtkTextIter* gtkTextIter;
51 	protected bool ownedRef;
52 
53 	/** Get the main Gtk struct */
54 	public GtkTextIter* getTextIterStruct(bool transferOwnership = false)
55 	{
56 		if (transferOwnership)
57 			ownedRef = false;
58 		return gtkTextIter;
59 	}
60 
61 	/** the main Gtk struct as a void* */
62 	protected void* getStruct()
63 	{
64 		return cast(void*)gtkTextIter;
65 	}
66 
67 	/**
68 	 * Sets our main struct and passes it to the parent class.
69 	 */
70 	public this (GtkTextIter* gtkTextIter, bool ownedRef = false)
71 	{
72 		this.gtkTextIter = gtkTextIter;
73 		this.ownedRef = ownedRef;
74 	}
75 
76 	~this ()
77 	{
78 		if (  Linker.isLoaded(LIBRARY_GTK) && ownedRef )
79 			gtk_text_iter_free(gtkTextIter);
80 	}
81 
82 	/** */
83 	public this()
84 	{
85 		this(new GtkTextIter);
86 	}
87 
88 	/**
89 	 */
90 
91 	/** */
92 	public static GType getType()
93 	{
94 		return gtk_text_iter_get_type();
95 	}
96 
97 	/**
98 	 * Assigns the value of @other to @iter.  This function
99 	 * is not useful in applications, because iterators can be assigned
100 	 * with `GtkTextIter i = j;`. The
101 	 * function is used by language bindings.
102 	 *
103 	 * Params:
104 	 *     other = another #GtkTextIter
105 	 *
106 	 * Since: 3.2
107 	 */
108 	public void assign(TextIter other)
109 	{
110 		gtk_text_iter_assign(gtkTextIter, (other is null) ? null : other.getTextIterStruct());
111 	}
112 
113 	/**
114 	 * Moves backward by one character offset. Returns %TRUE if movement
115 	 * was possible; if @iter was the first in the buffer (character
116 	 * offset 0), gtk_text_iter_backward_char() returns %FALSE for convenience when
117 	 * writing loops.
118 	 *
119 	 * Returns: whether movement was possible
120 	 */
121 	public bool backwardChar()
122 	{
123 		return gtk_text_iter_backward_char(gtkTextIter) != 0;
124 	}
125 
126 	/**
127 	 * Moves @count characters backward, if possible (if @count would move
128 	 * past the start or end of the buffer, moves to the start or end of
129 	 * the buffer).  The return value indicates whether the iterator moved
130 	 * onto a dereferenceable position; if the iterator didn’t move, or
131 	 * moved onto the end iterator, then %FALSE is returned. If @count is 0,
132 	 * the function does nothing and returns %FALSE.
133 	 *
134 	 * Params:
135 	 *     count = number of characters to move
136 	 *
137 	 * Returns: whether @iter moved and is dereferenceable
138 	 */
139 	public bool backwardChars(int count)
140 	{
141 		return gtk_text_iter_backward_chars(gtkTextIter, count) != 0;
142 	}
143 
144 	/**
145 	 * Like gtk_text_iter_forward_cursor_position(), but moves backward.
146 	 *
147 	 * Returns: %TRUE if we moved
148 	 */
149 	public bool backwardCursorPosition()
150 	{
151 		return gtk_text_iter_backward_cursor_position(gtkTextIter) != 0;
152 	}
153 
154 	/**
155 	 * Moves up to @count cursor positions. See
156 	 * gtk_text_iter_forward_cursor_position() for details.
157 	 *
158 	 * Params:
159 	 *     count = number of positions to move
160 	 *
161 	 * Returns: %TRUE if we moved and the new position is dereferenceable
162 	 */
163 	public bool backwardCursorPositions(int count)
164 	{
165 		return gtk_text_iter_backward_cursor_positions(gtkTextIter, count) != 0;
166 	}
167 
168 	/**
169 	 * Same as gtk_text_iter_forward_find_char(), but goes backward from @iter.
170 	 *
171 	 * Params:
172 	 *     pred = function to be called on each character
173 	 *     userData = user data for @pred
174 	 *     limit = search limit, or %NULL for none
175 	 *
176 	 * Returns: whether a match was found
177 	 */
178 	public bool backwardFindChar(GtkTextCharPredicate pred, void* userData, TextIter limit)
179 	{
180 		return gtk_text_iter_backward_find_char(gtkTextIter, pred, userData, (limit is null) ? null : limit.getTextIterStruct()) != 0;
181 	}
182 
183 	/**
184 	 * Moves @iter to the start of the previous line. Returns %TRUE if
185 	 * @iter could be moved; i.e. if @iter was at character offset 0, this
186 	 * function returns %FALSE. Therefore if @iter was already on line 0,
187 	 * but not at the start of the line, @iter is snapped to the start of
188 	 * the line and the function returns %TRUE. (Note that this implies that
189 	 * in a loop calling this function, the line number may not change on
190 	 * every iteration, if your first iteration is on line 0.)
191 	 *
192 	 * Returns: whether @iter moved
193 	 */
194 	public bool backwardLine()
195 	{
196 		return gtk_text_iter_backward_line(gtkTextIter) != 0;
197 	}
198 
199 	/**
200 	 * Moves @count lines backward, if possible (if @count would move
201 	 * past the start or end of the buffer, moves to the start or end of
202 	 * the buffer).  The return value indicates whether the iterator moved
203 	 * onto a dereferenceable position; if the iterator didn’t move, or
204 	 * moved onto the end iterator, then %FALSE is returned. If @count is 0,
205 	 * the function does nothing and returns %FALSE. If @count is negative,
206 	 * moves forward by 0 - @count lines.
207 	 *
208 	 * Params:
209 	 *     count = number of lines to move backward
210 	 *
211 	 * Returns: whether @iter moved and is dereferenceable
212 	 */
213 	public bool backwardLines(int count)
214 	{
215 		return gtk_text_iter_backward_lines(gtkTextIter, count) != 0;
216 	}
217 
218 	/**
219 	 * Same as gtk_text_iter_forward_search(), but moves backward.
220 	 *
221 	 * @match_end will never be set to a #GtkTextIter located after @iter, even if
222 	 * there is a possible @match_start before or at @iter.
223 	 *
224 	 * Params:
225 	 *     str = search string
226 	 *     flags = bitmask of flags affecting the search
227 	 *     matchStart = return location for start of match, or %NULL
228 	 *     matchEnd = return location for end of match, or %NULL
229 	 *     limit = location of last possible @match_start, or %NULL for start of buffer
230 	 *
231 	 * Returns: whether a match was found
232 	 */
233 	public bool backwardSearch(string str, GtkTextSearchFlags flags, out TextIter matchStart, out TextIter matchEnd, TextIter limit)
234 	{
235 		GtkTextIter* outmatchStart = gMalloc!GtkTextIter();
236 		GtkTextIter* outmatchEnd = gMalloc!GtkTextIter();
237 		
238 		auto p = gtk_text_iter_backward_search(gtkTextIter, Str.toStringz(str), flags, outmatchStart, outmatchEnd, (limit is null) ? null : limit.getTextIterStruct()) != 0;
239 		
240 		matchStart = ObjectG.getDObject!(TextIter)(outmatchStart, true);
241 		matchEnd = ObjectG.getDObject!(TextIter)(outmatchEnd, true);
242 		
243 		return p;
244 	}
245 
246 	/**
247 	 * Moves backward to the previous sentence start; if @iter is already at
248 	 * the start of a sentence, moves backward to the next one.  Sentence
249 	 * boundaries are determined by Pango and should be correct for nearly
250 	 * any language (if not, the correct fix would be to the Pango text
251 	 * boundary algorithms).
252 	 *
253 	 * Returns: %TRUE if @iter moved and is not the end iterator
254 	 */
255 	public bool backwardSentenceStart()
256 	{
257 		return gtk_text_iter_backward_sentence_start(gtkTextIter) != 0;
258 	}
259 
260 	/**
261 	 * Calls gtk_text_iter_backward_sentence_start() up to @count times,
262 	 * or until it returns %FALSE. If @count is negative, moves forward
263 	 * instead of backward.
264 	 *
265 	 * Params:
266 	 *     count = number of sentences to move
267 	 *
268 	 * Returns: %TRUE if @iter moved and is not the end iterator
269 	 */
270 	public bool backwardSentenceStarts(int count)
271 	{
272 		return gtk_text_iter_backward_sentence_starts(gtkTextIter, count) != 0;
273 	}
274 
275 	/**
276 	 * Moves backward to the next toggle (on or off) of the
277 	 * #GtkTextTag @tag, or to the next toggle of any tag if
278 	 * @tag is %NULL. If no matching tag toggles are found,
279 	 * returns %FALSE, otherwise %TRUE. Does not return toggles
280 	 * located at @iter, only toggles before @iter. Sets @iter
281 	 * to the location of the toggle, or the start of the buffer
282 	 * if no toggle is found.
283 	 *
284 	 * Params:
285 	 *     tag = a #GtkTextTag, or %NULL
286 	 *
287 	 * Returns: whether we found a tag toggle before @iter
288 	 */
289 	public bool backwardToTagToggle(TextTag tag)
290 	{
291 		return gtk_text_iter_backward_to_tag_toggle(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()) != 0;
292 	}
293 
294 	/**
295 	 * Moves @iter forward to the previous visible cursor position. See
296 	 * gtk_text_iter_backward_cursor_position() for details.
297 	 *
298 	 * Returns: %TRUE if we moved and the new position is dereferenceable
299 	 *
300 	 * Since: 2.4
301 	 */
302 	public bool backwardVisibleCursorPosition()
303 	{
304 		return gtk_text_iter_backward_visible_cursor_position(gtkTextIter) != 0;
305 	}
306 
307 	/**
308 	 * Moves up to @count visible cursor positions. See
309 	 * gtk_text_iter_backward_cursor_position() for details.
310 	 *
311 	 * Params:
312 	 *     count = number of positions to move
313 	 *
314 	 * Returns: %TRUE if we moved and the new position is dereferenceable
315 	 *
316 	 * Since: 2.4
317 	 */
318 	public bool backwardVisibleCursorPositions(int count)
319 	{
320 		return gtk_text_iter_backward_visible_cursor_positions(gtkTextIter, count) != 0;
321 	}
322 
323 	/**
324 	 * Moves @iter to the start of the previous visible line. Returns %TRUE if
325 	 * @iter could be moved; i.e. if @iter was at character offset 0, this
326 	 * function returns %FALSE. Therefore if @iter was already on line 0,
327 	 * but not at the start of the line, @iter is snapped to the start of
328 	 * the line and the function returns %TRUE. (Note that this implies that
329 	 * in a loop calling this function, the line number may not change on
330 	 * every iteration, if your first iteration is on line 0.)
331 	 *
332 	 * Returns: whether @iter moved
333 	 *
334 	 * Since: 2.8
335 	 */
336 	public bool backwardVisibleLine()
337 	{
338 		return gtk_text_iter_backward_visible_line(gtkTextIter) != 0;
339 	}
340 
341 	/**
342 	 * Moves @count visible lines backward, if possible (if @count would move
343 	 * past the start or end of the buffer, moves to the start or end of
344 	 * the buffer).  The return value indicates whether the iterator moved
345 	 * onto a dereferenceable position; if the iterator didn’t move, or
346 	 * moved onto the end iterator, then %FALSE is returned. If @count is 0,
347 	 * the function does nothing and returns %FALSE. If @count is negative,
348 	 * moves forward by 0 - @count lines.
349 	 *
350 	 * Params:
351 	 *     count = number of lines to move backward
352 	 *
353 	 * Returns: whether @iter moved and is dereferenceable
354 	 *
355 	 * Since: 2.8
356 	 */
357 	public bool backwardVisibleLines(int count)
358 	{
359 		return gtk_text_iter_backward_visible_lines(gtkTextIter, count) != 0;
360 	}
361 
362 	/**
363 	 * Moves backward to the previous visible word start. (If @iter is currently
364 	 * on a word start, moves backward to the next one after that.) Word breaks
365 	 * are determined by Pango and should be correct for nearly any
366 	 * language (if not, the correct fix would be to the Pango word break
367 	 * algorithms).
368 	 *
369 	 * Returns: %TRUE if @iter moved and is not the end iterator
370 	 *
371 	 * Since: 2.4
372 	 */
373 	public bool backwardVisibleWordStart()
374 	{
375 		return gtk_text_iter_backward_visible_word_start(gtkTextIter) != 0;
376 	}
377 
378 	/**
379 	 * Calls gtk_text_iter_backward_visible_word_start() up to @count times.
380 	 *
381 	 * Params:
382 	 *     count = number of times to move
383 	 *
384 	 * Returns: %TRUE if @iter moved and is not the end iterator
385 	 *
386 	 * Since: 2.4
387 	 */
388 	public bool backwardVisibleWordStarts(int count)
389 	{
390 		return gtk_text_iter_backward_visible_word_starts(gtkTextIter, count) != 0;
391 	}
392 
393 	/**
394 	 * Moves backward to the previous word start. (If @iter is currently on a
395 	 * word start, moves backward to the next one after that.) Word breaks
396 	 * are determined by Pango and should be correct for nearly any
397 	 * language (if not, the correct fix would be to the Pango word break
398 	 * algorithms).
399 	 *
400 	 * Returns: %TRUE if @iter moved and is not the end iterator
401 	 */
402 	public bool backwardWordStart()
403 	{
404 		return gtk_text_iter_backward_word_start(gtkTextIter) != 0;
405 	}
406 
407 	/**
408 	 * Calls gtk_text_iter_backward_word_start() up to @count times.
409 	 *
410 	 * Params:
411 	 *     count = number of times to move
412 	 *
413 	 * Returns: %TRUE if @iter moved and is not the end iterator
414 	 */
415 	public bool backwardWordStarts(int count)
416 	{
417 		return gtk_text_iter_backward_word_starts(gtkTextIter, count) != 0;
418 	}
419 
420 	/**
421 	 * Returns %TRUE if @tag is toggled on at exactly this point. If @tag
422 	 * is %NULL, returns %TRUE if any tag is toggled on at this point.
423 	 *
424 	 * Note that if gtk_text_iter_begins_tag() returns %TRUE, it means that @iter is
425 	 * at the beginning of the tagged range, and that the
426 	 * character at @iter is inside the tagged range. In other
427 	 * words, unlike gtk_text_iter_ends_tag(), if gtk_text_iter_begins_tag() returns
428 	 * %TRUE, gtk_text_iter_has_tag() will also return %TRUE for the same
429 	 * parameters.
430 	 *
431 	 * Deprecated: Use gtk_text_iter_starts_tag() instead.
432 	 *
433 	 * Params:
434 	 *     tag = a #GtkTextTag, or %NULL
435 	 *
436 	 * Returns: whether @iter is the start of a range tagged with @tag
437 	 */
438 	public bool beginsTag(TextTag tag)
439 	{
440 		return gtk_text_iter_begins_tag(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()) != 0;
441 	}
442 
443 	/**
444 	 * Considering the default editability of the buffer, and tags that
445 	 * affect editability, determines whether text inserted at @iter would
446 	 * be editable. If text inserted at @iter would be editable then the
447 	 * user should be allowed to insert text at @iter.
448 	 * gtk_text_buffer_insert_interactive() uses this function to decide
449 	 * whether insertions are allowed at a given position.
450 	 *
451 	 * Params:
452 	 *     defaultEditability = %TRUE if text is editable by default
453 	 *
454 	 * Returns: whether text inserted at @iter would be editable
455 	 */
456 	public bool canInsert(bool defaultEditability)
457 	{
458 		return gtk_text_iter_can_insert(gtkTextIter, defaultEditability) != 0;
459 	}
460 
461 	/**
462 	 * A qsort()-style function that returns negative if @lhs is less than
463 	 * @rhs, positive if @lhs is greater than @rhs, and 0 if they’re equal.
464 	 * Ordering is in character offset order, i.e. the first character in the buffer
465 	 * is less than the second character in the buffer.
466 	 *
467 	 * Params:
468 	 *     rhs = another #GtkTextIter
469 	 *
470 	 * Returns: -1 if @lhs is less than @rhs, 1 if @lhs is greater, 0 if they are equal
471 	 */
472 	public int compare(TextIter rhs)
473 	{
474 		return gtk_text_iter_compare(gtkTextIter, (rhs is null) ? null : rhs.getTextIterStruct());
475 	}
476 
477 	/**
478 	 * Creates a dynamically-allocated copy of an iterator. This function
479 	 * is not useful in applications, because iterators can be copied with a
480 	 * simple assignment (`GtkTextIter i = j;`). The
481 	 * function is used by language bindings.
482 	 *
483 	 * Returns: a copy of the @iter, free with gtk_text_iter_free()
484 	 */
485 	public TextIter copy()
486 	{
487 		auto p = gtk_text_iter_copy(gtkTextIter);
488 		
489 		if(p is null)
490 		{
491 			return null;
492 		}
493 		
494 		return ObjectG.getDObject!(TextIter)(cast(GtkTextIter*) p, true);
495 	}
496 
497 	/**
498 	 * Returns whether the character at @iter is within an editable region
499 	 * of text.  Non-editable text is “locked” and can’t be changed by the
500 	 * user via #GtkTextView. This function is simply a convenience
501 	 * wrapper around gtk_text_iter_get_attributes(). If no tags applied
502 	 * to this text affect editability, @default_setting will be returned.
503 	 *
504 	 * You don’t want to use this function to decide whether text can be
505 	 * inserted at @iter, because for insertion you don’t want to know
506 	 * whether the char at @iter is inside an editable range, you want to
507 	 * know whether a new character inserted at @iter would be inside an
508 	 * editable range. Use gtk_text_iter_can_insert() to handle this
509 	 * case.
510 	 *
511 	 * Params:
512 	 *     defaultSetting = %TRUE if text is editable by default
513 	 *
514 	 * Returns: whether @iter is inside an editable range
515 	 */
516 	public bool editable(bool defaultSetting)
517 	{
518 		return gtk_text_iter_editable(gtkTextIter, defaultSetting) != 0;
519 	}
520 
521 	/**
522 	 * Returns %TRUE if @iter points to the start of the paragraph
523 	 * delimiter characters for a line (delimiters will be either a
524 	 * newline, a carriage return, a carriage return followed by a
525 	 * newline, or a Unicode paragraph separator character). Note that an
526 	 * iterator pointing to the \n of a \r\n pair will not be counted as
527 	 * the end of a line, the line ends before the \r. The end iterator is
528 	 * considered to be at the end of a line, even though there are no
529 	 * paragraph delimiter chars there.
530 	 *
531 	 * Returns: whether @iter is at the end of a line
532 	 */
533 	public bool endsLine()
534 	{
535 		return gtk_text_iter_ends_line(gtkTextIter) != 0;
536 	}
537 
538 	/**
539 	 * Determines whether @iter ends a sentence.  Sentence boundaries are
540 	 * determined by Pango and should be correct for nearly any language
541 	 * (if not, the correct fix would be to the Pango text boundary
542 	 * algorithms).
543 	 *
544 	 * Returns: %TRUE if @iter is at the end of a sentence.
545 	 */
546 	public bool endsSentence()
547 	{
548 		return gtk_text_iter_ends_sentence(gtkTextIter) != 0;
549 	}
550 
551 	/**
552 	 * Returns %TRUE if @tag is toggled off at exactly this point. If @tag
553 	 * is %NULL, returns %TRUE if any tag is toggled off at this point.
554 	 *
555 	 * Note that if gtk_text_iter_ends_tag() returns %TRUE, it means that @iter is
556 	 * at the end of the tagged range, but that the character
557 	 * at @iter is outside the tagged range. In other words,
558 	 * unlike gtk_text_iter_starts_tag(), if gtk_text_iter_ends_tag() returns %TRUE,
559 	 * gtk_text_iter_has_tag() will return %FALSE for the same parameters.
560 	 *
561 	 * Params:
562 	 *     tag = a #GtkTextTag, or %NULL
563 	 *
564 	 * Returns: whether @iter is the end of a range tagged with @tag
565 	 */
566 	public bool endsTag(TextTag tag)
567 	{
568 		return gtk_text_iter_ends_tag(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()) != 0;
569 	}
570 
571 	/**
572 	 * Determines whether @iter ends a natural-language word.  Word breaks
573 	 * are determined by Pango and should be correct for nearly any
574 	 * language (if not, the correct fix would be to the Pango word break
575 	 * algorithms).
576 	 *
577 	 * Returns: %TRUE if @iter is at the end of a word
578 	 */
579 	public bool endsWord()
580 	{
581 		return gtk_text_iter_ends_word(gtkTextIter) != 0;
582 	}
583 
584 	/**
585 	 * Tests whether two iterators are equal, using the fastest possible
586 	 * mechanism. This function is very fast; you can expect it to perform
587 	 * better than e.g. getting the character offset for each iterator and
588 	 * comparing the offsets yourself. Also, it’s a bit faster than
589 	 * gtk_text_iter_compare().
590 	 *
591 	 * Params:
592 	 *     rhs = another #GtkTextIter
593 	 *
594 	 * Returns: %TRUE if the iterators point to the same place in the buffer
595 	 */
596 	public bool equal(TextIter rhs)
597 	{
598 		return gtk_text_iter_equal(gtkTextIter, (rhs is null) ? null : rhs.getTextIterStruct()) != 0;
599 	}
600 
601 	/**
602 	 * Moves @iter forward by one character offset. Note that images
603 	 * embedded in the buffer occupy 1 character slot, so
604 	 * gtk_text_iter_forward_char() may actually move onto an image instead
605 	 * of a character, if you have images in your buffer.  If @iter is the
606 	 * end iterator or one character before it, @iter will now point at
607 	 * the end iterator, and gtk_text_iter_forward_char() returns %FALSE for
608 	 * convenience when writing loops.
609 	 *
610 	 * Returns: whether @iter moved and is dereferenceable
611 	 */
612 	public bool forwardChar()
613 	{
614 		return gtk_text_iter_forward_char(gtkTextIter) != 0;
615 	}
616 
617 	/**
618 	 * Moves @count characters if possible (if @count would move past the
619 	 * start or end of the buffer, moves to the start or end of the
620 	 * buffer). The return value indicates whether the new position of
621 	 * @iter is different from its original position, and dereferenceable
622 	 * (the last iterator in the buffer is not dereferenceable). If @count
623 	 * is 0, the function does nothing and returns %FALSE.
624 	 *
625 	 * Params:
626 	 *     count = number of characters to move, may be negative
627 	 *
628 	 * Returns: whether @iter moved and is dereferenceable
629 	 */
630 	public bool forwardChars(int count)
631 	{
632 		return gtk_text_iter_forward_chars(gtkTextIter, count) != 0;
633 	}
634 
635 	/**
636 	 * Moves @iter forward by a single cursor position. Cursor positions
637 	 * are (unsurprisingly) positions where the cursor can appear. Perhaps
638 	 * surprisingly, there may not be a cursor position between all
639 	 * characters. The most common example for European languages would be
640 	 * a carriage return/newline sequence. For some Unicode characters,
641 	 * the equivalent of say the letter “a” with an accent mark will be
642 	 * represented as two characters, first the letter then a "combining
643 	 * mark" that causes the accent to be rendered; so the cursor can’t go
644 	 * between those two characters. See also the #PangoLogAttr-struct and
645 	 * pango_break() function.
646 	 *
647 	 * Returns: %TRUE if we moved and the new position is dereferenceable
648 	 */
649 	public bool forwardCursorPosition()
650 	{
651 		return gtk_text_iter_forward_cursor_position(gtkTextIter) != 0;
652 	}
653 
654 	/**
655 	 * Moves up to @count cursor positions. See
656 	 * gtk_text_iter_forward_cursor_position() for details.
657 	 *
658 	 * Params:
659 	 *     count = number of positions to move
660 	 *
661 	 * Returns: %TRUE if we moved and the new position is dereferenceable
662 	 */
663 	public bool forwardCursorPositions(int count)
664 	{
665 		return gtk_text_iter_forward_cursor_positions(gtkTextIter, count) != 0;
666 	}
667 
668 	/**
669 	 * Advances @iter, calling @pred on each character. If
670 	 * @pred returns %TRUE, returns %TRUE and stops scanning.
671 	 * If @pred never returns %TRUE, @iter is set to @limit if
672 	 * @limit is non-%NULL, otherwise to the end iterator.
673 	 *
674 	 * Params:
675 	 *     pred = a function to be called on each character
676 	 *     userData = user data for @pred
677 	 *     limit = search limit, or %NULL for none
678 	 *
679 	 * Returns: whether a match was found
680 	 */
681 	public bool forwardFindChar(GtkTextCharPredicate pred, void* userData, TextIter limit)
682 	{
683 		return gtk_text_iter_forward_find_char(gtkTextIter, pred, userData, (limit is null) ? null : limit.getTextIterStruct()) != 0;
684 	}
685 
686 	/**
687 	 * Moves @iter to the start of the next line. If the iter is already on the
688 	 * last line of the buffer, moves the iter to the end of the current line.
689 	 * If after the operation, the iter is at the end of the buffer and not
690 	 * dereferencable, returns %FALSE. Otherwise, returns %TRUE.
691 	 *
692 	 * Returns: whether @iter can be dereferenced
693 	 */
694 	public bool forwardLine()
695 	{
696 		return gtk_text_iter_forward_line(gtkTextIter) != 0;
697 	}
698 
699 	/**
700 	 * Moves @count lines forward, if possible (if @count would move
701 	 * past the start or end of the buffer, moves to the start or end of
702 	 * the buffer).  The return value indicates whether the iterator moved
703 	 * onto a dereferenceable position; if the iterator didn’t move, or
704 	 * moved onto the end iterator, then %FALSE is returned. If @count is 0,
705 	 * the function does nothing and returns %FALSE. If @count is negative,
706 	 * moves backward by 0 - @count lines.
707 	 *
708 	 * Params:
709 	 *     count = number of lines to move forward
710 	 *
711 	 * Returns: whether @iter moved and is dereferenceable
712 	 */
713 	public bool forwardLines(int count)
714 	{
715 		return gtk_text_iter_forward_lines(gtkTextIter, count) != 0;
716 	}
717 
718 	/**
719 	 * Searches forward for @str. Any match is returned by setting
720 	 * @match_start to the first character of the match and @match_end to the
721 	 * first character after the match. The search will not continue past
722 	 * @limit. Note that a search is a linear or O(n) operation, so you
723 	 * may wish to use @limit to avoid locking up your UI on large
724 	 * buffers.
725 	 *
726 	 * @match_start will never be set to a #GtkTextIter located before @iter, even if
727 	 * there is a possible @match_end after or at @iter.
728 	 *
729 	 * Params:
730 	 *     str = a search string
731 	 *     flags = flags affecting how the search is done
732 	 *     matchStart = return location for start of match, or %NULL
733 	 *     matchEnd = return location for end of match, or %NULL
734 	 *     limit = location of last possible @match_end, or %NULL for the end of the buffer
735 	 *
736 	 * Returns: whether a match was found
737 	 */
738 	public bool forwardSearch(string str, GtkTextSearchFlags flags, out TextIter matchStart, out TextIter matchEnd, TextIter limit)
739 	{
740 		GtkTextIter* outmatchStart = gMalloc!GtkTextIter();
741 		GtkTextIter* outmatchEnd = gMalloc!GtkTextIter();
742 		
743 		auto p = gtk_text_iter_forward_search(gtkTextIter, Str.toStringz(str), flags, outmatchStart, outmatchEnd, (limit is null) ? null : limit.getTextIterStruct()) != 0;
744 		
745 		matchStart = ObjectG.getDObject!(TextIter)(outmatchStart, true);
746 		matchEnd = ObjectG.getDObject!(TextIter)(outmatchEnd, true);
747 		
748 		return p;
749 	}
750 
751 	/**
752 	 * Moves forward to the next sentence end. (If @iter is at the end of
753 	 * a sentence, moves to the next end of sentence.)  Sentence
754 	 * boundaries are determined by Pango and should be correct for nearly
755 	 * any language (if not, the correct fix would be to the Pango text
756 	 * boundary algorithms).
757 	 *
758 	 * Returns: %TRUE if @iter moved and is not the end iterator
759 	 */
760 	public bool forwardSentenceEnd()
761 	{
762 		return gtk_text_iter_forward_sentence_end(gtkTextIter) != 0;
763 	}
764 
765 	/**
766 	 * Calls gtk_text_iter_forward_sentence_end() @count times (or until
767 	 * gtk_text_iter_forward_sentence_end() returns %FALSE). If @count is
768 	 * negative, moves backward instead of forward.
769 	 *
770 	 * Params:
771 	 *     count = number of sentences to move
772 	 *
773 	 * Returns: %TRUE if @iter moved and is not the end iterator
774 	 */
775 	public bool forwardSentenceEnds(int count)
776 	{
777 		return gtk_text_iter_forward_sentence_ends(gtkTextIter, count) != 0;
778 	}
779 
780 	/**
781 	 * Moves @iter forward to the “end iterator,” which points one past the last
782 	 * valid character in the buffer. gtk_text_iter_get_char() called on the
783 	 * end iterator returns 0, which is convenient for writing loops.
784 	 */
785 	public void forwardToEnd()
786 	{
787 		gtk_text_iter_forward_to_end(gtkTextIter);
788 	}
789 
790 	/**
791 	 * Moves the iterator to point to the paragraph delimiter characters,
792 	 * which will be either a newline, a carriage return, a carriage
793 	 * return/newline in sequence, or the Unicode paragraph separator
794 	 * character. If the iterator is already at the paragraph delimiter
795 	 * characters, moves to the paragraph delimiter characters for the
796 	 * next line. If @iter is on the last line in the buffer, which does
797 	 * not end in paragraph delimiters, moves to the end iterator (end of
798 	 * the last line), and returns %FALSE.
799 	 *
800 	 * Returns: %TRUE if we moved and the new location is not the end iterator
801 	 */
802 	public bool forwardToLineEnd()
803 	{
804 		return gtk_text_iter_forward_to_line_end(gtkTextIter) != 0;
805 	}
806 
807 	/**
808 	 * Moves forward to the next toggle (on or off) of the
809 	 * #GtkTextTag @tag, or to the next toggle of any tag if
810 	 * @tag is %NULL. If no matching tag toggles are found,
811 	 * returns %FALSE, otherwise %TRUE. Does not return toggles
812 	 * located at @iter, only toggles after @iter. Sets @iter to
813 	 * the location of the toggle, or to the end of the buffer
814 	 * if no toggle is found.
815 	 *
816 	 * Params:
817 	 *     tag = a #GtkTextTag, or %NULL
818 	 *
819 	 * Returns: whether we found a tag toggle after @iter
820 	 */
821 	public bool forwardToTagToggle(TextTag tag)
822 	{
823 		return gtk_text_iter_forward_to_tag_toggle(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()) != 0;
824 	}
825 
826 	/**
827 	 * Moves @iter forward to the next visible cursor position. See
828 	 * gtk_text_iter_forward_cursor_position() for details.
829 	 *
830 	 * Returns: %TRUE if we moved and the new position is dereferenceable
831 	 *
832 	 * Since: 2.4
833 	 */
834 	public bool forwardVisibleCursorPosition()
835 	{
836 		return gtk_text_iter_forward_visible_cursor_position(gtkTextIter) != 0;
837 	}
838 
839 	/**
840 	 * Moves up to @count visible cursor positions. See
841 	 * gtk_text_iter_forward_cursor_position() for details.
842 	 *
843 	 * Params:
844 	 *     count = number of positions to move
845 	 *
846 	 * Returns: %TRUE if we moved and the new position is dereferenceable
847 	 *
848 	 * Since: 2.4
849 	 */
850 	public bool forwardVisibleCursorPositions(int count)
851 	{
852 		return gtk_text_iter_forward_visible_cursor_positions(gtkTextIter, count) != 0;
853 	}
854 
855 	/**
856 	 * Moves @iter to the start of the next visible line. Returns %TRUE if there
857 	 * was a next line to move to, and %FALSE if @iter was simply moved to
858 	 * the end of the buffer and is now not dereferenceable, or if @iter was
859 	 * already at the end of the buffer.
860 	 *
861 	 * Returns: whether @iter can be dereferenced
862 	 *
863 	 * Since: 2.8
864 	 */
865 	public bool forwardVisibleLine()
866 	{
867 		return gtk_text_iter_forward_visible_line(gtkTextIter) != 0;
868 	}
869 
870 	/**
871 	 * Moves @count visible lines forward, if possible (if @count would move
872 	 * past the start or end of the buffer, moves to the start or end of
873 	 * the buffer).  The return value indicates whether the iterator moved
874 	 * onto a dereferenceable position; if the iterator didn’t move, or
875 	 * moved onto the end iterator, then %FALSE is returned. If @count is 0,
876 	 * the function does nothing and returns %FALSE. If @count is negative,
877 	 * moves backward by 0 - @count lines.
878 	 *
879 	 * Params:
880 	 *     count = number of lines to move forward
881 	 *
882 	 * Returns: whether @iter moved and is dereferenceable
883 	 *
884 	 * Since: 2.8
885 	 */
886 	public bool forwardVisibleLines(int count)
887 	{
888 		return gtk_text_iter_forward_visible_lines(gtkTextIter, count) != 0;
889 	}
890 
891 	/**
892 	 * Moves forward to the next visible word end. (If @iter is currently on a
893 	 * word end, moves forward to the next one after that.) Word breaks
894 	 * are determined by Pango and should be correct for nearly any
895 	 * language (if not, the correct fix would be to the Pango word break
896 	 * algorithms).
897 	 *
898 	 * Returns: %TRUE if @iter moved and is not the end iterator
899 	 *
900 	 * Since: 2.4
901 	 */
902 	public bool forwardVisibleWordEnd()
903 	{
904 		return gtk_text_iter_forward_visible_word_end(gtkTextIter) != 0;
905 	}
906 
907 	/**
908 	 * Calls gtk_text_iter_forward_visible_word_end() up to @count times.
909 	 *
910 	 * Params:
911 	 *     count = number of times to move
912 	 *
913 	 * Returns: %TRUE if @iter moved and is not the end iterator
914 	 *
915 	 * Since: 2.4
916 	 */
917 	public bool forwardVisibleWordEnds(int count)
918 	{
919 		return gtk_text_iter_forward_visible_word_ends(gtkTextIter, count) != 0;
920 	}
921 
922 	/**
923 	 * Moves forward to the next word end. (If @iter is currently on a
924 	 * word end, moves forward to the next one after that.) Word breaks
925 	 * are determined by Pango and should be correct for nearly any
926 	 * language (if not, the correct fix would be to the Pango word break
927 	 * algorithms).
928 	 *
929 	 * Returns: %TRUE if @iter moved and is not the end iterator
930 	 */
931 	public bool forwardWordEnd()
932 	{
933 		return gtk_text_iter_forward_word_end(gtkTextIter) != 0;
934 	}
935 
936 	/**
937 	 * Calls gtk_text_iter_forward_word_end() up to @count times.
938 	 *
939 	 * Params:
940 	 *     count = number of times to move
941 	 *
942 	 * Returns: %TRUE if @iter moved and is not the end iterator
943 	 */
944 	public bool forwardWordEnds(int count)
945 	{
946 		return gtk_text_iter_forward_word_ends(gtkTextIter, count) != 0;
947 	}
948 
949 	/**
950 	 * Free an iterator allocated on the heap. This function
951 	 * is intended for use in language bindings, and is not
952 	 * especially useful for applications, because iterators can
953 	 * simply be allocated on the stack.
954 	 */
955 	public void free()
956 	{
957 		gtk_text_iter_free(gtkTextIter);
958 		ownedRef = false;
959 	}
960 
961 	/**
962 	 * Computes the effect of any tags applied to this spot in the
963 	 * text. The @values parameter should be initialized to the default
964 	 * settings you wish to use if no tags are in effect. You’d typically
965 	 * obtain the defaults from gtk_text_view_get_default_attributes().
966 	 *
967 	 * gtk_text_iter_get_attributes() will modify @values, applying the
968 	 * effects of any tags present at @iter. If any tags affected @values,
969 	 * the function returns %TRUE.
970 	 *
971 	 * Params:
972 	 *     values = a #GtkTextAttributes to be filled in
973 	 *
974 	 * Returns: %TRUE if @values was modified
975 	 */
976 	public bool getAttributes(out TextAttributes values)
977 	{
978 		GtkTextAttributes* outvalues = gMalloc!GtkTextAttributes();
979 		
980 		auto p = gtk_text_iter_get_attributes(gtkTextIter, outvalues) != 0;
981 		
982 		values = ObjectG.getDObject!(TextAttributes)(outvalues, true);
983 		
984 		return p;
985 	}
986 
987 	/**
988 	 * Returns the #GtkTextBuffer this iterator is associated with.
989 	 *
990 	 * Returns: the buffer
991 	 */
992 	public TextBuffer getBuffer()
993 	{
994 		auto p = gtk_text_iter_get_buffer(gtkTextIter);
995 		
996 		if(p is null)
997 		{
998 			return null;
999 		}
1000 		
1001 		return ObjectG.getDObject!(TextBuffer)(cast(GtkTextBuffer*) p);
1002 	}
1003 
1004 	/**
1005 	 * Returns the number of bytes in the line containing @iter,
1006 	 * including the paragraph delimiters.
1007 	 *
1008 	 * Returns: number of bytes in the line
1009 	 */
1010 	public int getBytesInLine()
1011 	{
1012 		return gtk_text_iter_get_bytes_in_line(gtkTextIter);
1013 	}
1014 
1015 	/**
1016 	 * The Unicode character at this iterator is returned.  (Equivalent to
1017 	 * operator* on a C++ iterator.)  If the element at this iterator is a
1018 	 * non-character element, such as an image embedded in the buffer, the
1019 	 * Unicode “unknown” character 0xFFFC is returned. If invoked on
1020 	 * the end iterator, zero is returned; zero is not a valid Unicode character.
1021 	 * So you can write a loop which ends when gtk_text_iter_get_char()
1022 	 * returns 0.
1023 	 *
1024 	 * Returns: a Unicode character, or 0 if @iter is not dereferenceable
1025 	 */
1026 	public dchar getChar()
1027 	{
1028 		return gtk_text_iter_get_char(gtkTextIter);
1029 	}
1030 
1031 	/**
1032 	 * Returns the number of characters in the line containing @iter,
1033 	 * including the paragraph delimiters.
1034 	 *
1035 	 * Returns: number of characters in the line
1036 	 */
1037 	public int getCharsInLine()
1038 	{
1039 		return gtk_text_iter_get_chars_in_line(gtkTextIter);
1040 	}
1041 
1042 	/**
1043 	 * If the location at @iter contains a child anchor, the
1044 	 * anchor is returned (with no new reference count added). Otherwise,
1045 	 * %NULL is returned.
1046 	 *
1047 	 * Returns: the anchor at @iter
1048 	 */
1049 	public TextChildAnchor getChildAnchor()
1050 	{
1051 		auto p = gtk_text_iter_get_child_anchor(gtkTextIter);
1052 		
1053 		if(p is null)
1054 		{
1055 			return null;
1056 		}
1057 		
1058 		return ObjectG.getDObject!(TextChildAnchor)(cast(GtkTextChildAnchor*) p);
1059 	}
1060 
1061 	/**
1062 	 * A convenience wrapper around gtk_text_iter_get_attributes(),
1063 	 * which returns the language in effect at @iter. If no tags affecting
1064 	 * language apply to @iter, the return value is identical to that of
1065 	 * gtk_get_default_language().
1066 	 *
1067 	 * Returns: language in effect at @iter
1068 	 */
1069 	public PgLanguage getLanguage()
1070 	{
1071 		auto p = gtk_text_iter_get_language(gtkTextIter);
1072 		
1073 		if(p is null)
1074 		{
1075 			return null;
1076 		}
1077 		
1078 		return ObjectG.getDObject!(PgLanguage)(cast(PangoLanguage*) p, true);
1079 	}
1080 
1081 	/**
1082 	 * Returns the line number containing the iterator. Lines in
1083 	 * a #GtkTextBuffer are numbered beginning with 0 for the first
1084 	 * line in the buffer.
1085 	 *
1086 	 * Returns: a line number
1087 	 */
1088 	public int getLine()
1089 	{
1090 		return gtk_text_iter_get_line(gtkTextIter);
1091 	}
1092 
1093 	/**
1094 	 * Returns the byte index of the iterator, counting
1095 	 * from the start of a newline-terminated line.
1096 	 * Remember that #GtkTextBuffer encodes text in
1097 	 * UTF-8, and that characters can require a variable
1098 	 * number of bytes to represent.
1099 	 *
1100 	 * Returns: distance from start of line, in bytes
1101 	 */
1102 	public int getLineIndex()
1103 	{
1104 		return gtk_text_iter_get_line_index(gtkTextIter);
1105 	}
1106 
1107 	/**
1108 	 * Returns the character offset of the iterator,
1109 	 * counting from the start of a newline-terminated line.
1110 	 * The first character on the line has offset 0.
1111 	 *
1112 	 * Returns: offset from start of line
1113 	 */
1114 	public int getLineOffset()
1115 	{
1116 		return gtk_text_iter_get_line_offset(gtkTextIter);
1117 	}
1118 
1119 	/**
1120 	 * Returns a list of all #GtkTextMark at this location. Because marks
1121 	 * are not iterable (they don’t take up any "space" in the buffer,
1122 	 * they are just marks in between iterable locations), multiple marks
1123 	 * can exist in the same place. The returned list is not in any
1124 	 * meaningful order.
1125 	 *
1126 	 * Returns: list of #GtkTextMark
1127 	 */
1128 	public ListSG getMarks()
1129 	{
1130 		auto p = gtk_text_iter_get_marks(gtkTextIter);
1131 		
1132 		if(p is null)
1133 		{
1134 			return null;
1135 		}
1136 		
1137 		return new ListSG(cast(GSList*) p);
1138 	}
1139 
1140 	/**
1141 	 * Returns the character offset of an iterator.
1142 	 * Each character in a #GtkTextBuffer has an offset,
1143 	 * starting with 0 for the first character in the buffer.
1144 	 * Use gtk_text_buffer_get_iter_at_offset() to convert an
1145 	 * offset back into an iterator.
1146 	 *
1147 	 * Returns: a character offset
1148 	 */
1149 	public int getOffset()
1150 	{
1151 		return gtk_text_iter_get_offset(gtkTextIter);
1152 	}
1153 
1154 	/**
1155 	 * If the element at @iter is a pixbuf, the pixbuf is returned
1156 	 * (with no new reference count added). Otherwise,
1157 	 * %NULL is returned.
1158 	 *
1159 	 * Returns: the pixbuf at @iter
1160 	 */
1161 	public Pixbuf getPixbuf()
1162 	{
1163 		auto p = gtk_text_iter_get_pixbuf(gtkTextIter);
1164 		
1165 		if(p is null)
1166 		{
1167 			return null;
1168 		}
1169 		
1170 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
1171 	}
1172 
1173 	/**
1174 	 * Returns the text in the given range. A “slice” is an array of
1175 	 * characters encoded in UTF-8 format, including the Unicode “unknown”
1176 	 * character 0xFFFC for iterable non-character elements in the buffer,
1177 	 * such as images.  Because images are encoded in the slice, byte and
1178 	 * character offsets in the returned array will correspond to byte
1179 	 * offsets in the text buffer. Note that 0xFFFC can occur in normal
1180 	 * text as well, so it is not a reliable indicator that a pixbuf or
1181 	 * widget is in the buffer.
1182 	 *
1183 	 * Params:
1184 	 *     end = iterator at end of a range
1185 	 *
1186 	 * Returns: slice of text from the buffer
1187 	 */
1188 	public string getSlice(TextIter end)
1189 	{
1190 		auto retStr = gtk_text_iter_get_slice(gtkTextIter, (end is null) ? null : end.getTextIterStruct());
1191 		
1192 		scope(exit) Str.freeString(retStr);
1193 		return Str.toString(retStr);
1194 	}
1195 
1196 	/**
1197 	 * Returns a list of tags that apply to @iter, in ascending order of
1198 	 * priority (highest-priority tags are last). The #GtkTextTag in the
1199 	 * list don’t have a reference added, but you have to free the list
1200 	 * itself.
1201 	 *
1202 	 * Returns: list of #GtkTextTag
1203 	 */
1204 	public ListSG getTags()
1205 	{
1206 		auto p = gtk_text_iter_get_tags(gtkTextIter);
1207 		
1208 		if(p is null)
1209 		{
1210 			return null;
1211 		}
1212 		
1213 		return new ListSG(cast(GSList*) p);
1214 	}
1215 
1216 	/**
1217 	 * Returns text in the given range.  If the range
1218 	 * contains non-text elements such as images, the character and byte
1219 	 * offsets in the returned string will not correspond to character and
1220 	 * byte offsets in the buffer. If you want offsets to correspond, see
1221 	 * gtk_text_iter_get_slice().
1222 	 *
1223 	 * Params:
1224 	 *     end = iterator at end of a range
1225 	 *
1226 	 * Returns: array of characters from the buffer
1227 	 */
1228 	public string getText(TextIter end)
1229 	{
1230 		auto retStr = gtk_text_iter_get_text(gtkTextIter, (end is null) ? null : end.getTextIterStruct());
1231 		
1232 		scope(exit) Str.freeString(retStr);
1233 		return Str.toString(retStr);
1234 	}
1235 
1236 	/**
1237 	 * Returns a list of #GtkTextTag that are toggled on or off at this
1238 	 * point.  (If @toggled_on is %TRUE, the list contains tags that are
1239 	 * toggled on.) If a tag is toggled on at @iter, then some non-empty
1240 	 * range of characters following @iter has that tag applied to it.  If
1241 	 * a tag is toggled off, then some non-empty range following @iter
1242 	 * does not have the tag applied to it.
1243 	 *
1244 	 * Params:
1245 	 *     toggledOn = %TRUE to get toggled-on tags
1246 	 *
1247 	 * Returns: tags toggled at this point
1248 	 */
1249 	public ListSG getToggledTags(bool toggledOn)
1250 	{
1251 		auto p = gtk_text_iter_get_toggled_tags(gtkTextIter, toggledOn);
1252 		
1253 		if(p is null)
1254 		{
1255 			return null;
1256 		}
1257 		
1258 		return new ListSG(cast(GSList*) p);
1259 	}
1260 
1261 	/**
1262 	 * Returns the number of bytes from the start of the
1263 	 * line to the given @iter, not counting bytes that
1264 	 * are invisible due to tags with the “invisible” flag
1265 	 * toggled on.
1266 	 *
1267 	 * Returns: byte index of @iter with respect to the start of the line
1268 	 */
1269 	public int getVisibleLineIndex()
1270 	{
1271 		return gtk_text_iter_get_visible_line_index(gtkTextIter);
1272 	}
1273 
1274 	/**
1275 	 * Returns the offset in characters from the start of the
1276 	 * line to the given @iter, not counting characters that
1277 	 * are invisible due to tags with the “invisible” flag
1278 	 * toggled on.
1279 	 *
1280 	 * Returns: offset in visible characters from the start of the line
1281 	 */
1282 	public int getVisibleLineOffset()
1283 	{
1284 		return gtk_text_iter_get_visible_line_offset(gtkTextIter);
1285 	}
1286 
1287 	/**
1288 	 * Like gtk_text_iter_get_slice(), but invisible text is not included.
1289 	 * Invisible text is usually invisible because a #GtkTextTag with the
1290 	 * “invisible” attribute turned on has been applied to it.
1291 	 *
1292 	 * Params:
1293 	 *     end = iterator at end of range
1294 	 *
1295 	 * Returns: slice of text from the buffer
1296 	 */
1297 	public string getVisibleSlice(TextIter end)
1298 	{
1299 		auto retStr = gtk_text_iter_get_visible_slice(gtkTextIter, (end is null) ? null : end.getTextIterStruct());
1300 		
1301 		scope(exit) Str.freeString(retStr);
1302 		return Str.toString(retStr);
1303 	}
1304 
1305 	/**
1306 	 * Like gtk_text_iter_get_text(), but invisible text is not included.
1307 	 * Invisible text is usually invisible because a #GtkTextTag with the
1308 	 * “invisible” attribute turned on has been applied to it.
1309 	 *
1310 	 * Params:
1311 	 *     end = iterator at end of range
1312 	 *
1313 	 * Returns: string containing visible text in the
1314 	 *     range
1315 	 */
1316 	public string getVisibleText(TextIter end)
1317 	{
1318 		auto retStr = gtk_text_iter_get_visible_text(gtkTextIter, (end is null) ? null : end.getTextIterStruct());
1319 		
1320 		scope(exit) Str.freeString(retStr);
1321 		return Str.toString(retStr);
1322 	}
1323 
1324 	/**
1325 	 * Returns %TRUE if @iter points to a character that is part of a range tagged
1326 	 * with @tag. See also gtk_text_iter_starts_tag() and gtk_text_iter_ends_tag().
1327 	 *
1328 	 * Params:
1329 	 *     tag = a #GtkTextTag
1330 	 *
1331 	 * Returns: whether @iter is tagged with @tag
1332 	 */
1333 	public bool hasTag(TextTag tag)
1334 	{
1335 		return gtk_text_iter_has_tag(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()) != 0;
1336 	}
1337 
1338 	/**
1339 	 * Checks whether @iter falls in the range [@start, @end).
1340 	 * @start and @end must be in ascending order.
1341 	 *
1342 	 * Params:
1343 	 *     start = start of range
1344 	 *     end = end of range
1345 	 *
1346 	 * Returns: %TRUE if @iter is in the range
1347 	 */
1348 	public bool inRange(TextIter start, TextIter end)
1349 	{
1350 		return gtk_text_iter_in_range(gtkTextIter, (start is null) ? null : start.getTextIterStruct(), (end is null) ? null : end.getTextIterStruct()) != 0;
1351 	}
1352 
1353 	/**
1354 	 * Determines whether @iter is inside a sentence (as opposed to in
1355 	 * between two sentences, e.g. after a period and before the first
1356 	 * letter of the next sentence).  Sentence boundaries are determined
1357 	 * by Pango and should be correct for nearly any language (if not, the
1358 	 * correct fix would be to the Pango text boundary algorithms).
1359 	 *
1360 	 * Returns: %TRUE if @iter is inside a sentence.
1361 	 */
1362 	public bool insideSentence()
1363 	{
1364 		return gtk_text_iter_inside_sentence(gtkTextIter) != 0;
1365 	}
1366 
1367 	/**
1368 	 * Determines whether the character pointed by @iter is part of a
1369 	 * natural-language word (as opposed to say inside some whitespace).  Word
1370 	 * breaks are determined by Pango and should be correct for nearly any language
1371 	 * (if not, the correct fix would be to the Pango word break algorithms).
1372 	 *
1373 	 * Note that if gtk_text_iter_starts_word() returns %TRUE, then this function
1374 	 * returns %TRUE too, since @iter points to the first character of the word.
1375 	 *
1376 	 * Returns: %TRUE if @iter is inside a word
1377 	 */
1378 	public bool insideWord()
1379 	{
1380 		return gtk_text_iter_inside_word(gtkTextIter) != 0;
1381 	}
1382 
1383 	/**
1384 	 * See gtk_text_iter_forward_cursor_position() or #PangoLogAttr or
1385 	 * pango_break() for details on what a cursor position is.
1386 	 *
1387 	 * Returns: %TRUE if the cursor can be placed at @iter
1388 	 */
1389 	public bool isCursorPosition()
1390 	{
1391 		return gtk_text_iter_is_cursor_position(gtkTextIter) != 0;
1392 	}
1393 
1394 	/**
1395 	 * Returns %TRUE if @iter is the end iterator, i.e. one past the last
1396 	 * dereferenceable iterator in the buffer. gtk_text_iter_is_end() is
1397 	 * the most efficient way to check whether an iterator is the end
1398 	 * iterator.
1399 	 *
1400 	 * Returns: whether @iter is the end iterator
1401 	 */
1402 	public bool isEnd()
1403 	{
1404 		return gtk_text_iter_is_end(gtkTextIter) != 0;
1405 	}
1406 
1407 	/**
1408 	 * Returns %TRUE if @iter is the first iterator in the buffer, that is
1409 	 * if @iter has a character offset of 0.
1410 	 *
1411 	 * Returns: whether @iter is the first in the buffer
1412 	 */
1413 	public bool isStart()
1414 	{
1415 		return gtk_text_iter_is_start(gtkTextIter) != 0;
1416 	}
1417 
1418 	/**
1419 	 * Swaps the value of @first and @second if @second comes before
1420 	 * @first in the buffer. That is, ensures that @first and @second are
1421 	 * in sequence. Most text buffer functions that take a range call this
1422 	 * automatically on your behalf, so there’s no real reason to call it yourself
1423 	 * in those cases. There are some exceptions, such as gtk_text_iter_in_range(),
1424 	 * that expect a pre-sorted range.
1425 	 *
1426 	 * Params:
1427 	 *     second = another #GtkTextIter
1428 	 */
1429 	public void order(TextIter second)
1430 	{
1431 		gtk_text_iter_order(gtkTextIter, (second is null) ? null : second.getTextIterStruct());
1432 	}
1433 
1434 	/**
1435 	 * Moves iterator @iter to the start of the line @line_number.  If
1436 	 * @line_number is negative or larger than the number of lines in the
1437 	 * buffer, moves @iter to the start of the last line in the buffer.
1438 	 *
1439 	 * Params:
1440 	 *     lineNumber = line number (counted from 0)
1441 	 */
1442 	public void setLine(int lineNumber)
1443 	{
1444 		gtk_text_iter_set_line(gtkTextIter, lineNumber);
1445 	}
1446 
1447 	/**
1448 	 * Same as gtk_text_iter_set_line_offset(), but works with a
1449 	 * byte index. The given byte index must be at
1450 	 * the start of a character, it can’t be in the middle of a UTF-8
1451 	 * encoded character.
1452 	 *
1453 	 * Params:
1454 	 *     byteOnLine = a byte index relative to the start of @iter’s current line
1455 	 */
1456 	public void setLineIndex(int byteOnLine)
1457 	{
1458 		gtk_text_iter_set_line_index(gtkTextIter, byteOnLine);
1459 	}
1460 
1461 	/**
1462 	 * Moves @iter within a line, to a new character
1463 	 * (not byte) offset. The given character offset must be less than or
1464 	 * equal to the number of characters in the line; if equal, @iter
1465 	 * moves to the start of the next line. See
1466 	 * gtk_text_iter_set_line_index() if you have a byte index rather than
1467 	 * a character offset.
1468 	 *
1469 	 * Params:
1470 	 *     charOnLine = a character offset relative to the start of @iter’s current line
1471 	 */
1472 	public void setLineOffset(int charOnLine)
1473 	{
1474 		gtk_text_iter_set_line_offset(gtkTextIter, charOnLine);
1475 	}
1476 
1477 	/**
1478 	 * Sets @iter to point to @char_offset. @char_offset counts from the start
1479 	 * of the entire text buffer, starting with 0.
1480 	 *
1481 	 * Params:
1482 	 *     charOffset = a character number
1483 	 */
1484 	public void setOffset(int charOffset)
1485 	{
1486 		gtk_text_iter_set_offset(gtkTextIter, charOffset);
1487 	}
1488 
1489 	/**
1490 	 * Like gtk_text_iter_set_line_index(), but the index is in visible
1491 	 * bytes, i.e. text with a tag making it invisible is not counted
1492 	 * in the index.
1493 	 *
1494 	 * Params:
1495 	 *     byteOnLine = a byte index
1496 	 */
1497 	public void setVisibleLineIndex(int byteOnLine)
1498 	{
1499 		gtk_text_iter_set_visible_line_index(gtkTextIter, byteOnLine);
1500 	}
1501 
1502 	/**
1503 	 * Like gtk_text_iter_set_line_offset(), but the offset is in visible
1504 	 * characters, i.e. text with a tag making it invisible is not
1505 	 * counted in the offset.
1506 	 *
1507 	 * Params:
1508 	 *     charOnLine = a character offset
1509 	 */
1510 	public void setVisibleLineOffset(int charOnLine)
1511 	{
1512 		gtk_text_iter_set_visible_line_offset(gtkTextIter, charOnLine);
1513 	}
1514 
1515 	/**
1516 	 * Returns %TRUE if @iter begins a paragraph,
1517 	 * i.e. if gtk_text_iter_get_line_offset() would return 0.
1518 	 * However this function is potentially more efficient than
1519 	 * gtk_text_iter_get_line_offset() because it doesn’t have to compute
1520 	 * the offset, it just has to see whether it’s 0.
1521 	 *
1522 	 * Returns: whether @iter begins a line
1523 	 */
1524 	public bool startsLine()
1525 	{
1526 		return gtk_text_iter_starts_line(gtkTextIter) != 0;
1527 	}
1528 
1529 	/**
1530 	 * Determines whether @iter begins a sentence.  Sentence boundaries are
1531 	 * determined by Pango and should be correct for nearly any language
1532 	 * (if not, the correct fix would be to the Pango text boundary
1533 	 * algorithms).
1534 	 *
1535 	 * Returns: %TRUE if @iter is at the start of a sentence.
1536 	 */
1537 	public bool startsSentence()
1538 	{
1539 		return gtk_text_iter_starts_sentence(gtkTextIter) != 0;
1540 	}
1541 
1542 	/**
1543 	 * Returns %TRUE if @tag is toggled on at exactly this point. If @tag
1544 	 * is %NULL, returns %TRUE if any tag is toggled on at this point.
1545 	 *
1546 	 * Note that if gtk_text_iter_starts_tag() returns %TRUE, it means that @iter is
1547 	 * at the beginning of the tagged range, and that the
1548 	 * character at @iter is inside the tagged range. In other
1549 	 * words, unlike gtk_text_iter_ends_tag(), if gtk_text_iter_starts_tag() returns
1550 	 * %TRUE, gtk_text_iter_has_tag() will also return %TRUE for the same
1551 	 * parameters.
1552 	 *
1553 	 * Params:
1554 	 *     tag = a #GtkTextTag, or %NULL
1555 	 *
1556 	 * Returns: whether @iter is the start of a range tagged with @tag
1557 	 *
1558 	 * Since: 3.20
1559 	 */
1560 	public bool startsTag(TextTag tag)
1561 	{
1562 		return gtk_text_iter_starts_tag(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()) != 0;
1563 	}
1564 
1565 	/**
1566 	 * Determines whether @iter begins a natural-language word.  Word
1567 	 * breaks are determined by Pango and should be correct for nearly any
1568 	 * language (if not, the correct fix would be to the Pango word break
1569 	 * algorithms).
1570 	 *
1571 	 * Returns: %TRUE if @iter is at the start of a word
1572 	 */
1573 	public bool startsWord()
1574 	{
1575 		return gtk_text_iter_starts_word(gtkTextIter) != 0;
1576 	}
1577 
1578 	/**
1579 	 * This is equivalent to (gtk_text_iter_starts_tag() ||
1580 	 * gtk_text_iter_ends_tag()), i.e. it tells you whether a range with
1581 	 * @tag applied to it begins or ends at @iter.
1582 	 *
1583 	 * Params:
1584 	 *     tag = a #GtkTextTag, or %NULL
1585 	 *
1586 	 * Returns: whether @tag is toggled on or off at @iter
1587 	 */
1588 	public bool togglesTag(TextTag tag)
1589 	{
1590 		return gtk_text_iter_toggles_tag(gtkTextIter, (tag is null) ? null : tag.getTextTagStruct()) != 0;
1591 	}
1592 }