1
2@c %start of fragment
3
4@deftp Class <gtk-text-buffer>
5Derives from @code{<gobject>}.
6
7This class defines the following slots:
8
9@table @code
10@item tag-table
11Text Tag Table
12
13@item text
14Current text of the buffer
15
16@item has-selection
17Whether the buffer has some text currently selected
18
19@item cursor-position
20The position of the insert mark (as offset from the beginning of the buffer)
21
22@item copy-target-list
23The list of targets this buffer supports for clipboard copying and DND source
24
25@item paste-target-list
26The list of targets this buffer supports for clipboard pasting and DND
27destination
28
29@end table
30
31@end deftp
32
33@defop Signal <gtk-text-buffer> changed
34The changed signal is emitted when the content of a @code{<gtk-text-buffer>} has
35changed.
36
37@end defop
38
39@defop Signal <gtk-text-buffer> insert-text  (arg0@tie{}@code{<gtk-text-iter>}) (arg1@tie{}@code{<gchararray>}) (arg2@tie{}@code{<gint>})
40The insert_text signal is emitted to insert text in a @code{<gtk-text-buffer>}.
41Insertion actually occurs in the default handler.
42
43Note that if your handler runs before the default handler it must not invalidate
44the @var{location} iter (or has to revalidate it). The default signal handler
45revalidates it to point to the end of the inserted text.
46
47See also: @code{gtk-text-buffer-insert}, @code{gtk-text-buffer-insert-range}.
48
49@end defop
50
51@defop Signal <gtk-text-buffer> insert-pixbuf  (arg0@tie{}@code{<gtk-text-iter>}) (arg1@tie{}@code{<gdk-pixbuf>})
52The insert_pixbuf signal is emitted to insert a @code{<gdk-pixbuf>} in a
53@code{<gtk-text-buffer>}. Insertion actually occurs in the default handler.
54
55Note that if your handler runs before the default handler it must not invalidate
56the @var{location} iter (or has to revalidate it). The default signal handler
57revalidates it to be placed after the inserted @var{pixbuf}.
58
59See also: @code{gtk-text-buffer-insert-pixbuf}.
60
61@end defop
62
63@defop Signal <gtk-text-buffer> insert-child-anchor  (arg0@tie{}@code{<gtk-text-iter>}) (arg1@tie{}@code{<gtk-text-child-anchor>})
64The insert_child_anchor signal is emitted to insert a
65@code{<gtk-text-child-anchor>} in a @code{<gtk-text-buffer>}. Insertion actually
66occurs in the default handler.
67
68Note that if your handler runs before the default handler it must not invalidate
69the @var{location} iter (or has to revalidate it). The default signal handler
70revalidates it to be placed after the inserted @var{anchor}.
71
72See also: @code{gtk-text-buffer-insert-child-anchor}.
73
74@end defop
75
76@defop Signal <gtk-text-buffer> delete-range  (arg0@tie{}@code{<gtk-text-iter>}) (arg1@tie{}@code{<gtk-text-iter>})
77The delete_range signal is emitted to delete a range from a
78@code{<gtk-text-buffer>}.
79
80Note that if your handler runs before the default handler it must not invalidate
81the @var{start} and @var{end} iters (or has to revalidate them). The default
82signal handler revalidates the @var{start} and @var{end} iters to both point
83point to the location where text was deleted. Handlers which run after the
84default handler (see @code{g-signal-connect-after}) do not have access to the
85deleted text.
86
87See also: @code{gtk-text-buffer-delete}.
88
89@end defop
90
91@defop Signal <gtk-text-buffer> modified-changed
92The modified_changed signal is emitted when the modified bit of a
93@code{<gtk-text-buffer>} flips.
94
95See also: @code{gtk-text-buffer-set-modified}.
96
97@end defop
98
99@defop Signal <gtk-text-buffer> mark-set  (arg0@tie{}@code{<gtk-text-iter>}) (arg1@tie{}@code{<gtk-text-mark>})
100The mark_set signal is emitted as notification after a @code{<gtk-text-mark>} is
101set.
102
103See also: @code{gtk-text-buffer-create-mark}, @code{gtk-text-buffer-move-mark}.
104
105@end defop
106
107@defop Signal <gtk-text-buffer> mark-deleted  (arg0@tie{}@code{<gtk-text-mark>})
108The mark_deleted signal is emitted as notification after a
109@code{<gtk-text-mark>} is deleted.
110
111See also: @code{gtk-text-buffer-delete-mark}.
112
113@end defop
114
115@defop Signal <gtk-text-buffer> apply-tag  (arg0@tie{}@code{<gtk-text-tag>}) (arg1@tie{}@code{<gtk-text-iter>}) (arg2@tie{}@code{<gtk-text-iter>})
116The apply_tag signal is emitted to apply a tag to a range of text in a
117@code{<gtk-text-buffer>}. Applying actually occurs in the default handler.
118
119Note that if your handler runs before the default handler it must not invalidate
120the @var{start} and @var{end} iters (or has to revalidate them).
121
122See also: @code{gtk-text-buffer-apply-tag},
123@code{gtk-text-buffer-insert-with-tags}, @code{gtk-text-buffer-insert-range}.
124
125@end defop
126
127@defop Signal <gtk-text-buffer> remove-tag  (arg0@tie{}@code{<gtk-text-tag>}) (arg1@tie{}@code{<gtk-text-iter>}) (arg2@tie{}@code{<gtk-text-iter>})
128The remove_tag signal is emitted to remove all occurrences of @var{tag} from a
129range of text in a @code{<gtk-text-buffer>}. Removal actually occurs in the
130default handler.
131
132Note that if your handler runs before the default handler it must not invalidate
133the @var{start} and @var{end} iters (or has to revalidate them).
134
135See also: @code{gtk-text-buffer-remove-tag}.
136
137@end defop
138
139@defop Signal <gtk-text-buffer> begin-user-action
140The begin_user_action signal is emitted at the beginning of a single
141user-visible operation on a @code{<gtk-text-buffer>}.
142
143See also: @code{gtk-text-buffer-begin-user-action},
144@code{gtk-text-buffer-insert-interactive},
145@code{gtk-text-buffer-insert-range-interactive},
146@code{gtk-text-buffer-delete-interactive}, @code{gtk-text-buffer-backspace},
147@code{gtk-text-buffer-delete-selection}.
148
149@end defop
150
151@defop Signal <gtk-text-buffer> end-user-action
152The end_user_action signal is emitted at the end of a single user-visible
153operation @code{<gtk-text-buffer>}.
154
155See also: @code{gtk-text-buffer-end-user-action},
156@code{gtk-text-buffer-insert-interactive},
157@code{gtk-text-buffer-insert-range-interactive},
158@code{gtk-text-buffer-delete-interactive}, @code{gtk-text-buffer-backspace},
159@code{gtk-text-buffer-delete-selection}, @code{gtk-text-buffer-backspace}.
160
161@end defop
162
163@deffn Function gtk-text-buffer-new  (table@tie{}@code{<gtk-text-tag-table>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-buffer>})
164Creates a new text buffer.
165
166@table @var
167@item table
168a tag table, or NULL to create a new one
169
170@item ret
171a new text buffer
172
173@end table
174
175@end deffn
176
177@deffn Function gtk-text-buffer-get-line-count  (self@tie{}@code{<gtk-text-buffer>}) @result{}@tie{} (ret@tie{}@code{int})
178@deffnx Method get-line-count
179Obtains the number of lines in the buffer. This value is cached, so the function
180is very fast.
181
182@table @var
183@item buffer
184a @code{<gtk-text-buffer>}
185
186@item ret
187number of lines in the buffer
188
189@end table
190
191@end deffn
192
193@deffn Function gtk-text-buffer-get-char-count  (self@tie{}@code{<gtk-text-buffer>}) @result{}@tie{} (ret@tie{}@code{int})
194@deffnx Method get-char-count
195Gets the number of characters in the buffer; note that characters and bytes are
196not the same, you can't e.g. expect the contents of the buffer in string form to
197be this many bytes long. The character count is cached, so this function is very
198fast.
199
200@table @var
201@item buffer
202a @code{<gtk-text-buffer>}
203
204@item ret
205number of characters in the buffer
206
207@end table
208
209@end deffn
210
211@deffn Function gtk-text-buffer-get-tag-table  (self@tie{}@code{<gtk-text-buffer>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-tag-table>})
212@deffnx Method get-tag-table
213Get the @code{<gtk-text-tag-table>} associated with this buffer.
214
215@table @var
216@item buffer
217a @code{<gtk-text-buffer>}
218
219@item ret
220the buffer's tag table
221
222@end table
223
224@end deffn
225
226@deffn Function gtk-text-buffer-insert  (self@tie{}@code{<gtk-text-buffer>}) (iter@tie{}@code{<gtk-text-iter>}) (stext@tie{}@code{scm})
227@deffnx Method insert
228Inserts @var{len} bytes of @var{text} at position @var{iter}. If @var{len} is
229-1, @var{text} must be nul-terminated and will be inserted in its entirety.
230Emits the "insert_text" signal; insertion actually occurs in the default handler
231for the signal. @var{iter} is invalidated when insertion occurs (because the
232buffer contents change), but the default signal handler revalidates it to point
233to the end of the inserted text.
234
235@table @var
236@item buffer
237a @code{<gtk-text-buffer>}
238
239@item iter
240a position in the buffer
241
242@item text
243UTF-8 format text to insert
244
245@item len
246length of text in bytes, or -1
247
248@end table
249
250@end deffn
251
252@deffn Function gtk-text-buffer-insert-at-cursor  (self@tie{}@code{<gtk-text-buffer>}) (stext@tie{}@code{scm})
253@deffnx Method insert-at-cursor
254Simply calls @code{gtk-text-buffer-insert}, using the current cursor position as
255the insertion point.
256
257@table @var
258@item buffer
259a @code{<gtk-text-buffer>}
260
261@item text
262some text in UTF-8 format
263
264@item len
265length of text, in bytes
266
267@end table
268
269@end deffn
270
271@deffn Function gtk-text-buffer-insert-interactive  (self@tie{}@code{<gtk-text-buffer>}) (iter@tie{}@code{<gtk-text-iter>}) (stext@tie{}@code{scm}) (default_editable@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{bool})
272@deffnx Method insert-interactive
273Like @code{gtk-text-buffer-insert}, but the insertion will not occur if
274@var{iter} is at a non-editable location in the buffer. Usually you want to
275prevent insertions at ineditable locations if the insertion results from a user
276action (is interactive).
277
278@var{default-editable} indicates the editability of text that doesn't have a tag
279affecting editability applied to it. Typically the result of
280@code{gtk-text-view-get-editable} is appropriate here.
281
282@table @var
283@item buffer
284a @code{<gtk-text-buffer>}
285
286@item iter
287a position in @var{buffer}
288
289@item text
290some UTF-8 text
291
292@item len
293length of text in bytes, or -1
294
295@item default-editable
296default editability of buffer
297
298@item ret
299whether text was actually inserted
300
301@end table
302
303@end deffn
304
305@deffn Function gtk-text-buffer-insert-range  (self@tie{}@code{<gtk-text-buffer>}) (iter@tie{}@code{<gtk-text-iter>}) (start@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>})
306@deffnx Method insert-range
307Copies text, tags, and pixbufs between @var{start} and @var{end} (the order of
308@var{start} and @var{end} doesn't matter) and inserts the copy at @var{iter}.
309Used instead of simply getting/inserting text because it preserves images and
310tags. If @var{start} and @var{end} are in a different buffer from @var{buffer},
311the two buffers must share the same tag table.
312
313Implemented via emissions of the insert_text and apply_tag signals, so expect
314those.
315
316@table @var
317@item buffer
318a @code{<gtk-text-buffer>}
319
320@item iter
321a position in @var{buffer}
322
323@item start
324a position in a @code{<gtk-text-buffer>}
325
326@item end
327another position in the same buffer as @var{start}
328
329@end table
330
331@end deffn
332
333@deffn Function gtk-text-buffer-insert-with-tags  (self@tie{}@code{<gtk-text-buffer>}) (iter@tie{}@code{<gtk-text-iter>}) (stext@tie{}@code{scm}) (tag_list@tie{}@code{glist-of})
334@deffnx Method insert-with-tags
335Inserts @var{text} into @var{buffer} at @var{iter}, applying the list of tags to
336the newly-inserted text. The last tag specified must be NULL to terminate the
337list. Equivalent to calling @code{gtk-text-buffer-insert}, then
338@code{gtk-text-buffer-apply-tag} on the inserted text;
339@code{gtk-text-buffer-insert-with-tags} is just a convenience function.
340
341@table @var
342@item buffer
343a @code{<gtk-text-buffer>}
344
345@item iter
346an iterator in @var{buffer}
347
348@item text
349UTF-8 text
350
351@item len
352length of @var{text}, or -1
353
354@item first-tag
355first tag to apply to @var{text}
356
357@item ...
358NULL-terminated list of tags to apply
359
360@end table
361
362@end deffn
363
364@deffn Function gtk-text-buffer-delete  (self@tie{}@code{<gtk-text-buffer>}) (start@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>})
365@deffnx Method delete
366Deletes text between @var{start} and @var{end}. The order of @var{start} and
367@var{end} is not actually relevant; @code{gtk-text-buffer-delete} will reorder
368them. This function actually emits the "delete_range" signal, and the default
369handler of that signal deletes the text. Because the buffer is modified, all
370outstanding iterators become invalid after calling this function; however, the
371@var{start} and @var{end} will be re-initialized to point to the location where
372text was deleted.
373
374@table @var
375@item buffer
376a @code{<gtk-text-buffer>}
377
378@item start
379a position in @var{buffer}
380
381@item end
382another position in @var{buffer}
383
384@end table
385
386@end deffn
387
388@deffn Function gtk-text-buffer-delete-interactive  (self@tie{}@code{<gtk-text-buffer>}) (start_iter@tie{}@code{<gtk-text-iter>}) (end_iter@tie{}@code{<gtk-text-iter>}) (default_editable@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{bool})
389@deffnx Method delete-interactive
390Deletes all @emph{editable} text in the given range. Calls
391@code{gtk-text-buffer-delete} for each editable sub-range of
392[@var{start},@var{end}). @var{start} and @var{end} are revalidated to point to
393the location of the last deleted range, or left untouched if no text was
394deleted.
395
396@table @var
397@item buffer
398a @code{<gtk-text-buffer>}
399
400@item start-iter
401start of range to delete
402
403@item end-iter
404end of range
405
406@item default-editable
407whether the buffer is editable by default
408
409@item ret
410whether some text was actually deleted
411
412@end table
413
414@end deffn
415
416@deffn Function gtk-text-buffer-backspace  (self@tie{}@code{<gtk-text-buffer>}) (iter@tie{}@code{<gtk-text-iter>}) (interactive@tie{}@code{bool}) (default_editable@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{bool})
417@deffnx Method backspace
418Performs the appropriate action as if the user hit the delete key with the
419cursor at the position specified by @var{iter}. In the normal case a single
420character will be deleted, but when combining accents are involved, more than
421one character can be deleted, and when precomposed character and accent
422combinations are involved, less than one character will be deleted.
423
424Because the buffer is modified, all outstanding iterators become invalid after
425calling this function; however, the @var{iter} will be re-initialized to point
426to the location where text was deleted.
427
428@table @var
429@item buffer
430a @code{<gtk-text-buffer>}
431
432@item iter
433a position in @var{buffer}
434
435@item interactive
436whether the deletion is caused by user interaction
437
438@item default-editable
439whether the buffer is editable by default
440
441@item ret
442@samp{@code{#t}} if the buffer was modified
443
444@end table
445
446Since 2.6
447
448@end deffn
449
450@deffn Function gtk-text-buffer-set-text  (self@tie{}@code{<gtk-text-buffer>}) (stext@tie{}@code{scm})
451@deffnx Method set-text
452Deletes current contents of @var{buffer}, and inserts @var{text} instead. If
453@var{len} is -1, @var{text} must be nul-terminated. @var{text} must be valid
454UTF-8.
455
456@table @var
457@item buffer
458a @code{<gtk-text-buffer>}
459
460@item text
461UTF-8 text to insert
462
463@item len
464length of @var{text} in bytes
465
466@end table
467
468@end deffn
469
470@deffn Function gtk-text-buffer-get-text  (self@tie{}@code{<gtk-text-buffer>}) (start@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>}) (include_hidden_chars@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{mchars})
471@deffnx Method get-text
472Returns the text in the range [@var{start},@var{end}). Excludes undisplayed text
473(text marked with tags that set the invisibility attribute) if
474@var{include-hidden-chars} is @samp{@code{#f}}. Does not include characters
475representing embedded images, so byte and character indexes into the returned
476string do @emph{not} correspond to byte and character indexes into the buffer.
477Contrast with @code{gtk-text-buffer-get-slice}.
478
479@table @var
480@item buffer
481a @code{<gtk-text-buffer>}
482
483@item start
484start of a range
485
486@item end
487end of a range
488
489@item include-hidden-chars
490whether to include invisible text
491
492@item ret
493an allocated UTF-8 string
494
495@end table
496
497@end deffn
498
499@deffn Function gtk-text-buffer-get-slice  (self@tie{}@code{<gtk-text-buffer>}) (start@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>}) (include_hidden_chars@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{mchars})
500@deffnx Method get-slice
501Returns the text in the range [@var{start},@var{end}). Excludes undisplayed text
502(text marked with tags that set the invisibility attribute) if
503@var{include-hidden-chars} is @samp{@code{#f}}. The returned string includes a
5040xFFFC character whenever the buffer contains embedded images, so byte and
505character indexes into the returned string @emph{do} correspond to byte and
506character indexes into the buffer. Contrast with
507@code{gtk-text-buffer-get-text}. Note that 0xFFFC can occur in normal text as
508well, so it is not a reliable indicator that a pixbuf or widget is in the
509buffer.
510
511@table @var
512@item buffer
513a @code{<gtk-text-buffer>}
514
515@item start
516start of a range
517
518@item end
519end of a range
520
521@item include-hidden-chars
522whether to include invisible text
523
524@item ret
525an allocated UTF-8 string
526
527@end table
528
529@end deffn
530
531@deffn Function gtk-text-buffer-insert-pixbuf  (self@tie{}@code{<gtk-text-buffer>}) (iter@tie{}@code{<gtk-text-iter>}) (pixbuf@tie{}@code{<gdk-pixbuf>})
532@deffnx Method insert-pixbuf
533Inserts an image into the text buffer at @var{iter}. The image will be counted
534as one character in character counts, and when obtaining the buffer contents as
535a string, will be represented by the Unicode "object replacement character"
5360xFFFC. Note that the "slice" variants for obtaining portions of the buffer as a
537string include this character for pixbufs, but the "text" variants do not. e.g.
538see @code{gtk-text-buffer-get-slice} and @code{gtk-text-buffer-get-text}.
539
540@table @var
541@item buffer
542a @code{<gtk-text-buffer>}
543
544@item iter
545location to insert the pixbuf
546
547@item pixbuf
548a @code{<gdk-pixbuf>}
549
550@end table
551
552@end deffn
553
554@deffn Function gtk-text-buffer-insert-child-anchor  (self@tie{}@code{<gtk-text-buffer>}) (iter@tie{}@code{<gtk-text-iter>}) (anchor@tie{}@code{<gtk-text-child-anchor>})
555@deffnx Method insert-child-anchor
556Inserts a child widget anchor into the text buffer at @var{iter}. The anchor
557will be counted as one character in character counts, and when obtaining the
558buffer contents as a string, will be represented by the Unicode "object
559replacement character" 0xFFFC. Note that the "slice" variants for obtaining
560portions of the buffer as a string include this character for child anchors, but
561the "text" variants do not. e.g. see @code{gtk-text-buffer-get-slice} and
562@code{gtk-text-buffer-get-text}. Consider
563@code{gtk-text-buffer-create-child-anchor} as a more convenient alternative to
564this function. The buffer will add a reference to the anchor, so you can unref
565it after insertion.
566
567@table @var
568@item buffer
569a @code{<gtk-text-buffer>}
570
571@item iter
572location to insert the anchor
573
574@item anchor
575a @code{<gtk-text-child-anchor>}
576
577@end table
578
579@end deffn
580
581@deffn Function gtk-text-buffer-create-child-anchor  (self@tie{}@code{<gtk-text-buffer>}) (iter@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-child-anchor>})
582@deffnx Method create-child-anchor
583This is a convenience function which simply creates a child anchor with
584@code{gtk-text-child-anchor-new} and inserts it into the buffer with
585@code{gtk-text-buffer-insert-child-anchor}. The new anchor is owned by the
586buffer; no reference count is returned to the caller of
587@code{gtk-text-buffer-create-child-anchor}.
588
589@table @var
590@item buffer
591a @code{<gtk-text-buffer>}
592
593@item iter
594location in the buffer
595
596@item ret
597the created child anchor
598
599@end table
600
601@end deffn
602
603@deffn Function gtk-text-buffer-create-mark  (self@tie{}@code{<gtk-text-buffer>}) (mark_name@tie{}@code{mchars}) (where@tie{}@code{<gtk-text-iter>}) (left_gravity@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{<gtk-text-mark>})
604@deffnx Method create-mark
605Creates a mark at position @var{where}. If @var{mark-name} is @samp{@code{#f}},
606the mark is anonymous; otherwise, the mark can be retrieved by name using
607@code{gtk-text-buffer-get-mark}. If a mark has left gravity, and text is
608inserted at the mark's current location, the mark will be moved to the left of
609the newly-inserted text. If the mark has right gravity (@var{left-gravity} =
610@samp{@code{#f}}), the mark will end up on the right of newly-inserted text. The
611standard left-to-right cursor is a mark with right gravity (when you type, the
612cursor stays on the right side of the text you're typing).
613
614The caller of this function does @emph{not} own a reference to the returned
615@code{<gtk-text-mark>}, so you can ignore the return value if you like. Marks
616are owned by the buffer and go away when the buffer does.
617
618Emits the "mark_set" signal as notification of the mark's initial placement.
619
620@table @var
621@item buffer
622a @code{<gtk-text-buffer>}
623
624@item mark-name
625name for mark, or @samp{@code{#f}}
626
627@item where
628location to place mark
629
630@item left-gravity
631whether the mark has left gravity
632
633@item ret
634the new @code{<gtk-text-mark>} object
635
636@end table
637
638@end deffn
639
640@deffn Function gtk-text-buffer-move-mark  (self@tie{}@code{<gtk-text-buffer>}) (mark@tie{}@code{<gtk-text-mark>}) (where@tie{}@code{<gtk-text-iter>})
641@deffnx Method move-mark
642Moves @var{mark} to the new location @var{where}. Emits the "mark_set" signal as
643notification of the move.
644
645@table @var
646@item buffer
647a @code{<gtk-text-buffer>}
648
649@item mark
650a @code{<gtk-text-mark>}
651
652@item where
653new location for @var{mark} in @var{buffer}
654
655@end table
656
657@end deffn
658
659@deffn Function gtk-text-buffer-move-mark-by-name  (self@tie{}@code{<gtk-text-buffer>}) (name@tie{}@code{mchars}) (where@tie{}@code{<gtk-text-iter>})
660@deffnx Method move-mark-by-name
661Moves the mark named @var{name} (which must exist) to location @var{where}. See
662@code{gtk-text-buffer-move-mark} for details.
663
664@table @var
665@item buffer
666a @code{<gtk-text-buffer>}
667
668@item name
669name of a mark
670
671@item where
672new location for mark
673
674@end table
675
676@end deffn
677
678@deffn Function gtk-text-buffer-delete-mark  (self@tie{}@code{<gtk-text-buffer>}) (mark@tie{}@code{<gtk-text-mark>})
679@deffnx Method delete-mark
680Deletes @var{mark}, so that it's no longer located anywhere in the buffer.
681Removes the reference the buffer holds to the mark, so if you haven't called
682@code{g-object-ref} on the mark, it will be freed. Even if the mark isn't freed,
683most operations on @var{mark} become invalid. There is no way to undelete a
684mark. @code{gtk-text-mark-get-deleted} will return TRUE after this function has
685been called on a mark; @code{gtk-text-mark-get-deleted} indicates that a mark no
686longer belongs to a buffer. The "mark_deleted" signal will be emitted as
687notification after the mark is deleted.
688
689@table @var
690@item buffer
691a @code{<gtk-text-buffer>}
692
693@item mark
694a @code{<gtk-text-mark>} in @var{buffer}
695
696@end table
697
698@end deffn
699
700@deffn Function gtk-text-buffer-delete-mark-by-name  (self@tie{}@code{<gtk-text-buffer>}) (name@tie{}@code{mchars})
701@deffnx Method delete-mark-by-name
702Deletes the mark named @var{name}; the mark must exist. See
703@code{gtk-text-buffer-delete-mark} for details.
704
705@table @var
706@item buffer
707a @code{<gtk-text-buffer>}
708
709@item name
710name of a mark in @var{buffer}
711
712@end table
713
714@end deffn
715
716@deffn Function gtk-text-buffer-get-mark  (self@tie{}@code{<gtk-text-buffer>}) (name@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{<gtk-text-mark>})
717@deffnx Method get-mark
718Returns the mark named @var{name} in buffer @var{buffer}, or NULL if no such
719mark exists in the buffer.
720
721@table @var
722@item buffer
723a @code{<gtk-text-buffer>}
724
725@item name
726a mark name
727
728@item ret
729a @code{<gtk-text-mark>}, or NULL
730
731@end table
732
733@end deffn
734
735@deffn Function gtk-text-buffer-get-insert  (self@tie{}@code{<gtk-text-buffer>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-mark>})
736@deffnx Method get-insert
737Returns the mark that represents the cursor (insertion point). Equivalent to
738calling @code{gtk-text-buffer-get-mark} to get the mark named "insert", but very
739slightly more efficient, and involves less typing.
740
741@table @var
742@item buffer
743a @code{<gtk-text-buffer>}
744
745@item ret
746insertion point mark
747
748@end table
749
750@end deffn
751
752@deffn Function gtk-text-buffer-get-selection-bound  (self@tie{}@code{<gtk-text-buffer>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-mark>})
753@deffnx Method get-selection-bound
754Returns the mark that represents the selection bound. Equivalent to calling
755@code{gtk-text-buffer-get-mark} to get the mark named "selection_bound", but
756very slightly more efficient, and involves less typing.
757
758The currently-selected text in @var{buffer} is the region between the
759"selection_bound" and "insert" marks. If "selection_bound" and "insert" are in
760the same place, then there is no current selection.
761@code{gtk-text-buffer-get-selection-bounds} is another convenient function for
762handling the selection, if you just want to know whether there's a selection and
763what its bounds are.
764
765@table @var
766@item buffer
767a @code{<gtk-text-buffer>}
768
769@item ret
770selection bound mark
771
772@end table
773
774@end deffn
775
776@deffn Function gtk-text-buffer-get-has-selection  (self@tie{}@code{<gtk-text-buffer>}) @result{}@tie{} (ret@tie{}@code{bool})
777@deffnx Method get-has-selection
778Indicates whether the buffer has some text currently selected.
779
780@table @var
781@item buffer
782a @code{<gtk-text-buffer>}
783
784@item ret
785@samp{@code{#t}} if the there is text selected
786
787@end table
788
789Since 2.10
790
791@end deffn
792
793@deffn Function gtk-text-buffer-place-cursor  (self@tie{}@code{<gtk-text-buffer>}) (where@tie{}@code{<gtk-text-iter>})
794@deffnx Method place-cursor
795This function moves the "insert" and "selection_bound" marks simultaneously. If
796you move them to the same place in two steps with
797@code{gtk-text-buffer-move-mark}, you will temporarily select a region in
798between their old and new locations, which can be pretty inefficient since the
799temporarily-selected region will force stuff to be recalculated. This function
800moves them as a unit, which can be optimized.
801
802@table @var
803@item buffer
804a @code{<gtk-text-buffer>}
805
806@item where
807where to put the cursor
808
809@end table
810
811@end deffn
812
813@deffn Function gtk-text-buffer-select-range  (self@tie{}@code{<gtk-text-buffer>}) (ins@tie{}@code{<gtk-text-iter>}) (bound@tie{}@code{<gtk-text-iter>})
814@deffnx Method select-range
815This function moves the "insert" and "selection_bound" marks simultaneously. If
816you move them in two steps with @code{gtk-text-buffer-move-mark}, you will
817temporarily select a region in between their old and new locations, which can be
818pretty inefficient since the temporarily-selected region will force stuff to be
819recalculated. This function moves them as a unit, which can be optimized.
820
821@table @var
822@item buffer
823a @code{<gtk-text-buffer>}
824
825@item ins
826where to put the "insert" mark
827
828@item bound
829where to put the "selection_bound" mark
830
831@end table
832
833Since 2.4
834
835@end deffn
836
837@deffn Function gtk-text-buffer-apply-tag  (self@tie{}@code{<gtk-text-buffer>}) (tag@tie{}@code{<gtk-text-tag>}) (start@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>})
838@deffnx Method apply-tag
839Emits the "apply_tag" signal on @var{buffer}. The default handler for the signal
840applies @var{tag} to the given range. @var{start} and @var{end} do not have to
841be in order.
842
843@table @var
844@item buffer
845a @code{<gtk-text-buffer>}
846
847@item tag
848a @code{<gtk-text-tag>}
849
850@item start
851one bound of range to be tagged
852
853@item end
854other bound of range to be tagged
855
856@end table
857
858@end deffn
859
860@deffn Function gtk-text-buffer-remove-tag  (self@tie{}@code{<gtk-text-buffer>}) (tag@tie{}@code{<gtk-text-tag>}) (start@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>})
861@deffnx Method remove-tag
862Emits the "remove_tag" signal. The default handler for the signal removes all
863occurrences of @var{tag} from the given range. @var{start} and @var{end} don't
864have to be in order.
865
866@table @var
867@item buffer
868a @code{<gtk-text-buffer>}
869
870@item tag
871a @code{<gtk-text-tag>}
872
873@item start
874one bound of range to be untagged
875
876@item end
877other bound of range to be untagged
878
879@end table
880
881@end deffn
882
883@deffn Function gtk-text-buffer-apply-tag-by-name  (self@tie{}@code{<gtk-text-buffer>}) (name@tie{}@code{mchars}) (start@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>})
884@deffnx Method apply-tag-by-name
885Calls @code{gtk-text-tag-table-lookup} on the buffer's tag table to get a
886@code{<gtk-text-tag>}, then calls @code{gtk-text-buffer-apply-tag}.
887
888@table @var
889@item buffer
890a @code{<gtk-text-buffer>}
891
892@item name
893name of a named @code{<gtk-text-tag>}
894
895@item start
896one bound of range to be tagged
897
898@item end
899other bound of range to be tagged
900
901@end table
902
903@end deffn
904
905@deffn Function gtk-text-buffer-remove-tag-by-name  (self@tie{}@code{<gtk-text-buffer>}) (name@tie{}@code{mchars}) (start@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>})
906@deffnx Method remove-tag-by-name
907Calls @code{gtk-text-tag-table-lookup} on the buffer's tag table to get a
908@code{<gtk-text-tag>}, then calls @code{gtk-text-buffer-remove-tag}.
909
910@table @var
911@item buffer
912a @code{<gtk-text-buffer>}
913
914@item name
915name of a @code{<gtk-text-tag>}
916
917@item start
918one bound of range to be untagged
919
920@item end
921other bound of range to be untagged
922
923@end table
924
925@end deffn
926
927@deffn Function gtk-text-buffer-remove-all-tags  (self@tie{}@code{<gtk-text-buffer>}) (start@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>})
928@deffnx Method remove-all-tags
929Removes all tags in the range between @var{start} and @var{end}. Be careful with
930this function; it could remove tags added in code unrelated to the code you're
931currently writing. That is, using this function is probably a bad idea if you
932have two or more unrelated code sections that add tags.
933
934@table @var
935@item buffer
936a @code{<gtk-text-buffer>}
937
938@item start
939one bound of range to be untagged
940
941@item end
942other bound of range to be untagged
943
944@end table
945
946@end deffn
947
948@deffn Function gtk-text-buffer-get-iter-at-offset  (self@tie{}@code{<gtk-text-buffer>}) (char_offset@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{<gtk-text-iter>})
949@deffnx Method get-iter-at-offset
950Initializes @var{iter} to a position @var{char-offset} chars from the start of
951the entire buffer. If @var{char-offset} is -1 or greater than the number of
952characters in the buffer, @var{iter} is initialized to the end iterator, the
953iterator one past the last valid character in the buffer.
954
955@table @var
956@item buffer
957a @code{<gtk-text-buffer>}
958
959@item iter
960iterator to initialize
961
962@item char-offset
963char offset from start of buffer, counting from 0, or -1
964
965@end table
966
967@end deffn
968
969@deffn Function gtk-text-buffer-get-iter-at-line  (self@tie{}@code{<gtk-text-buffer>}) (line_number@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{<gtk-text-iter>})
970@deffnx Method get-iter-at-line
971Initializes @var{iter} to the start of the given line.
972
973@table @var
974@item buffer
975a @code{<gtk-text-buffer>}
976
977@item iter
978iterator to initialize
979
980@item line-number
981line number counting from 0
982
983@end table
984
985@end deffn
986
987@deffn Function gtk-text-buffer-get-iter-at-mark  (self@tie{}@code{<gtk-text-buffer>}) (mark@tie{}@code{<gtk-text-mark>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-iter>})
988@deffnx Method get-iter-at-mark
989Initializes @var{iter} with the current position of @var{mark}.
990
991@table @var
992@item buffer
993a @code{<gtk-text-buffer>}
994
995@item iter
996iterator to initialize
997
998@item mark
999a @code{<gtk-text-mark>} in @var{buffer}
1000
1001@end table
1002
1003@end deffn
1004
1005@deffn Function gtk-text-buffer-get-start-iter  (self@tie{}@code{<gtk-text-buffer>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-iter>})
1006@deffnx Method get-start-iter
1007Initialized @var{iter} with the first position in the text buffer. This is the
1008same as using @code{gtk-text-buffer-get-iter-at-offset} to get the iter at
1009character offset 0.
1010
1011@table @var
1012@item buffer
1013a @code{<gtk-text-buffer>}
1014
1015@item iter
1016iterator to initialize
1017
1018@end table
1019
1020@end deffn
1021
1022@deffn Function gtk-text-buffer-get-end-iter  (self@tie{}@code{<gtk-text-buffer>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-iter>})
1023@deffnx Method get-end-iter
1024Initializes @var{iter} with the "end iterator," one past the last valid
1025character in the text buffer. If dereferenced with
1026@code{gtk-text-iter-get-char}, the end iterator has a character value of 0. The
1027entire buffer lies in the range from the first position in the buffer (call
1028@code{gtk-text-buffer-get-start-iter} to get character position 0) to the end
1029iterator.
1030
1031@table @var
1032@item buffer
1033a @code{<gtk-text-buffer>}
1034
1035@item iter
1036iterator to initialize
1037
1038@end table
1039
1040@end deffn
1041
1042@deffn Function gtk-text-buffer-get-bounds  (self@tie{}@code{<gtk-text-buffer>}) @result{}@tie{} (start@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>})
1043@deffnx Method get-bounds
1044@deffnx Method get-bounds
1045Retrieves the first and last iterators in the buffer, i.e. the entire buffer
1046lies within the range [@var{start},@var{end}).
1047
1048@table @var
1049@item buffer
1050a @code{<gtk-text-buffer>}
1051
1052@item start
1053iterator to initialize with first position in the buffer
1054
1055@item end
1056iterator to initialize with the end iterator
1057
1058@end table
1059
1060@end deffn
1061
1062@deffn Function gtk-text-buffer-get-modified  (self@tie{}@code{<gtk-text-buffer>}) @result{}@tie{} (ret@tie{}@code{bool})
1063@deffnx Method get-modified
1064Indicates whether the buffer has been modified since the last call to
1065@code{gtk-text-buffer-set-modified} set the modification flag to
1066@samp{@code{#f}}. Used for example to enable a "save" function in a text editor.
1067
1068@table @var
1069@item buffer
1070a @code{<gtk-text-buffer>}
1071
1072@item ret
1073@samp{@code{#t}} if the buffer has been modified
1074
1075@end table
1076
1077@end deffn
1078
1079@deffn Function gtk-text-buffer-set-modified  (self@tie{}@code{<gtk-text-buffer>}) (setting@tie{}@code{bool})
1080@deffnx Method set-modified
1081Used to keep track of whether the buffer has been modified since the last time
1082it was saved. Whenever the buffer is saved to disk, call
1083gtk_text_buffer_set_modified (@var{buffer}, FALSE). When the buffer is modified,
1084it will automatically toggled on the modified bit again. When the modified bit
1085flips, the buffer emits a "modified_changed" signal.
1086
1087@table @var
1088@item buffer
1089a @code{<gtk-text-buffer>}
1090
1091@item setting
1092modification flag setting
1093
1094@end table
1095
1096@end deffn
1097
1098@deffn Function gtk-text-buffer-delete-selection  (self@tie{}@code{<gtk-text-buffer>}) (interactive@tie{}@code{bool}) (default_editable@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{bool})
1099@deffnx Method delete-selection
1100Deletes the range between the "insert" and "selection_bound" marks, that is, the
1101currently-selected text. If @var{interactive} is @samp{@code{#t}}, the
1102editability of the selection will be considered (users can't delete uneditable
1103text).
1104
1105@table @var
1106@item buffer
1107a @code{<gtk-text-buffer>}
1108
1109@item interactive
1110whether the deletion is caused by user interaction
1111
1112@item default-editable
1113whether the buffer is editable by default
1114
1115@item ret
1116whether there was a non-empty selection to delete
1117
1118@end table
1119
1120@end deffn
1121
1122@deffn Function gtk-text-buffer-paste-clipboard  (self@tie{}@code{<gtk-text-buffer>}) (clipboard@tie{}@code{<gtk-clipboard>}) (override_location@tie{}@code{<gtk-text-iter>}) (default_editable@tie{}@code{bool})
1123@deffnx Method paste-clipboard
1124Pastes the contents of a clipboard at the insertion point, or at
1125@var{override-location}. (Note: pasting is asynchronous, that is, we'll ask for
1126the paste data and return, and at some point later after the main loop runs, the
1127paste data will be inserted.)
1128
1129@table @var
1130@item buffer
1131a @code{<gtk-text-buffer>}
1132
1133@item clipboard
1134the @code{<gtk-clipboard>} to paste from
1135
1136@item override-location
1137location to insert pasted text, or @samp{@code{#f}} for at the cursor
1138
1139@item default-editable
1140whether the buffer is editable by default
1141
1142@end table
1143
1144@end deffn
1145
1146@deffn Function gtk-text-buffer-copy-clipboard  (self@tie{}@code{<gtk-text-buffer>}) (clipboard@tie{}@code{<gtk-clipboard>})
1147@deffnx Method copy-clipboard
1148Copies the currently-selected text to a clipboard.
1149
1150@table @var
1151@item buffer
1152a @code{<gtk-text-buffer>}
1153
1154@item clipboard
1155the @code{<gtk-clipboard>} object to copy to.
1156
1157@end table
1158
1159@end deffn
1160
1161@deffn Function gtk-text-buffer-cut-clipboard  (self@tie{}@code{<gtk-text-buffer>}) (clipboard@tie{}@code{<gtk-clipboard>}) (default_editable@tie{}@code{bool})
1162@deffnx Method cut-clipboard
1163Copies the currently-selected text to a clipboard, then deletes said text if
1164it's editable.
1165
1166@table @var
1167@item buffer
1168a @code{<gtk-text-buffer>}
1169
1170@item clipboard
1171the @code{<gtk-clipboard>} object to cut to.
1172
1173@item default-editable
1174default editability of the buffer
1175
1176@end table
1177
1178@end deffn
1179
1180@deffn Function gtk-text-buffer-begin-user-action  (self@tie{}@code{<gtk-text-buffer>})
1181@deffnx Method begin-user-action
1182Called to indicate that the buffer operations between here and a call to
1183@code{gtk-text-buffer-end-user-action} are part of a single user-visible
1184operation. The operations between @code{gtk-text-buffer-begin-user-action} and
1185@code{gtk-text-buffer-end-user-action} can then be grouped when creating an undo
1186stack. @code{<gtk-text-buffer>} maintains a count of calls to
1187@code{gtk-text-buffer-begin-user-action} that have not been closed with a call
1188to @code{gtk-text-buffer-end-user-action}, and emits the "begin_user_action" and
1189"end_user_action" signals only for the outermost pair of calls. This allows you
1190to build user actions from other user actions.
1191
1192The "interactive" buffer mutation functions, such as
1193@code{gtk-text-buffer-insert-interactive}, automatically call begin/end user
1194action around the buffer operations they perform, so there's no need to add
1195extra calls if you user action consists solely of a single call to one of those
1196functions.
1197
1198@table @var
1199@item buffer
1200a @code{<gtk-text-buffer>}
1201
1202@end table
1203
1204@end deffn
1205
1206@deffn Function gtk-text-buffer-end-user-action  (self@tie{}@code{<gtk-text-buffer>})
1207@deffnx Method end-user-action
1208Should be paired with a call to @code{gtk-text-buffer-begin-user-action}. See
1209that function for a full explanation.
1210
1211@table @var
1212@item buffer
1213a @code{<gtk-text-buffer>}
1214
1215@end table
1216
1217@end deffn
1218
1219
1220@c %end of fragment
1221