[−][src]Trait gtk::prelude::TextBufferExt
Required methods
fn add_mark<P: IsA<TextMark>>(&self, mark: &P, where_: &TextIter)
Adds the mark at position where_
. The mark must not be added to
another buffer, and if its name is not None
then there must not
be another mark in the buffer with the same name.
Emits the TextBuffer::mark-set
signal as notification of the mark's
initial placement.
mark
the mark to add
where_
location to place mark
fn add_selection_clipboard(&self, clipboard: &Clipboard)
Adds clipboard
to the list of clipboards in which the selection
contents of self
are available. In most cases, clipboard
will be
the Clipboard
of type GDK_SELECTION_PRIMARY
for a view of self
.
clipboard
a Clipboard
fn apply_tag<P: IsA<TextTag>>(&self, tag: &P, start: &TextIter, end: &TextIter)
Emits the “apply-tag” signal on self
. The default
handler for the signal applies tag
to the given range.
start
and end
do not have to be in order.
tag
a TextTag
start
one bound of range to be tagged
end
other bound of range to be tagged
fn apply_tag_by_name(&self, name: &str, start: &TextIter, end: &TextIter)
Calls TextTagTableExt::lookup
on the buffer’s tag table to
get a TextTag
, then calls TextBufferExt::apply_tag
.
name
name of a named TextTag
start
one bound of range to be tagged
end
other bound of range to be tagged
fn backspace(
&self,
iter: &mut TextIter,
interactive: bool,
default_editable: bool
) -> bool
&self,
iter: &mut TextIter,
interactive: bool,
default_editable: bool
) -> bool
Performs the appropriate action as if the user hit the delete
key with the cursor at the position specified by iter
. In the
normal case a single character will be deleted, but when
combining accents are involved, more than one character can
be deleted, and when precomposed character and accent combinations
are involved, less than one character will be deleted.
Because the buffer is modified, all outstanding iterators become
invalid after calling this function; however, the iter
will be
re-initialized to point to the location where text was deleted.
iter
a position in self
interactive
whether the deletion is caused by user interaction
default_editable
whether the buffer is editable by default
Returns
true
if the buffer was modified
fn begin_user_action(&self)
Called to indicate that the buffer operations between here and a
call to TextBufferExt::end_user_action
are part of a single
user-visible operation. The operations between
TextBufferExt::begin_user_action
and
TextBufferExt::end_user_action
can then be grouped when creating
an undo stack. TextBuffer
maintains a count of calls to
TextBufferExt::begin_user_action
that have not been closed with
a call to TextBufferExt::end_user_action
, and emits the
“begin-user-action” and “end-user-action” signals only for the
outermost pair of calls. This allows you to build user actions
from other user actions.
The “interactive” buffer mutation functions, such as
TextBufferExt::insert_interactive
, automatically call begin/end
user action around the buffer operations they perform, so there's
no need to add extra calls if you user action consists solely of a
single call to one of those functions.
fn copy_clipboard(&self, clipboard: &Clipboard)
fn create_child_anchor(&self, iter: &mut TextIter) -> Option<TextChildAnchor>
This is a convenience function which simply creates a child anchor
with TextChildAnchor::new
and inserts it into the buffer
with TextBufferExt::insert_child_anchor
. The new anchor is
owned by the buffer; no reference count is returned to
the caller of TextBufferExt::create_child_anchor
.
iter
location in the buffer
Returns
the created child anchor
fn create_mark(
&self,
mark_name: Option<&str>,
where_: &TextIter,
left_gravity: bool
) -> Option<TextMark>
&self,
mark_name: Option<&str>,
where_: &TextIter,
left_gravity: bool
) -> Option<TextMark>
Creates a mark at position where_
. If mark_name
is None
, the mark
is anonymous; otherwise, the mark can be retrieved by name using
TextBufferExt::get_mark
. If a mark has left gravity, and text is
inserted at the mark’s current location, the mark will be moved to
the left of the newly-inserted text. If the mark has right gravity
(left_gravity
= false
), the mark will end up on the right of
newly-inserted text. The standard left-to-right cursor is a mark
with right gravity (when you type, the cursor stays on the right
side of the text you’re typing).
The caller of this function does not own a
reference to the returned TextMark
, so you can ignore the
return value if you like. Marks are owned by the buffer and go
away when the buffer does.
Emits the TextBuffer::mark-set
signal as notification of the mark's
initial placement.
mark_name
name for mark, or None
where_
location to place mark
left_gravity
whether the mark has left gravity
Returns
the new TextMark
object
fn cut_clipboard(&self, clipboard: &Clipboard, default_editable: bool)
Copies the currently-selected text to a clipboard, then deletes said text if it’s editable.
clipboard
the Clipboard
object to cut to
default_editable
default editability of the buffer
fn delete(&self, start: &mut TextIter, end: &mut TextIter)
Deletes text between start
and end
. The order of start
and end
is not actually relevant; TextBufferExt::delete
will reorder
them. This function actually emits the “delete-range” signal, and
the default handler of that signal deletes the text. Because the
buffer is modified, all outstanding iterators become invalid after
calling this function; however, the start
and end
will be
re-initialized to point to the location where text was deleted.
start
a position in self
end
another position in self
fn delete_interactive(
&self,
start_iter: &mut TextIter,
end_iter: &mut TextIter,
default_editable: bool
) -> bool
&self,
start_iter: &mut TextIter,
end_iter: &mut TextIter,
default_editable: bool
) -> bool
Deletes all editable text in the given range.
Calls TextBufferExt::delete
for each editable sub-range of
[start
,end
). start
and end
are revalidated to point to
the location of the last deleted range, or left untouched if
no text was deleted.
start_iter
start of range to delete
end_iter
end of range
default_editable
whether the buffer is editable by default
Returns
whether some text was actually deleted
fn delete_mark<P: IsA<TextMark>>(&self, mark: &P)
Deletes mark
, so that it’s no longer located anywhere in the
buffer. Removes the reference the buffer holds to the mark, so if
you haven’t called gobject::ObjectExt::ref
on the mark, it will be freed. Even
if the mark isn’t freed, most operations on mark
become
invalid, until it gets added to a buffer again with
TextBufferExt::add_mark
. Use TextMarkExt::get_deleted
to
find out if a mark has been removed from its buffer.
The TextBuffer::mark-deleted
signal will be emitted as notification after
the mark is deleted.
mark
a TextMark
in self
fn delete_mark_by_name(&self, name: &str)
Deletes the mark named name
; the mark must exist. See
TextBufferExt::delete_mark
for details.
name
name of a mark in self
fn delete_selection(&self, interactive: bool, default_editable: bool) -> bool
Deletes the range between the “insert” and “selection_bound” marks,
that is, the currently-selected text. If interactive
is true
,
the editability of the selection will be considered (users can’t delete
uneditable text).
interactive
whether the deletion is caused by user interaction
default_editable
whether the buffer is editable by default
Returns
whether there was a non-empty selection to delete
fn deserialize<P: IsA<TextBuffer>>(
&self,
content_buffer: &P,
format: &Atom,
iter: &mut TextIter,
data: &[u8]
) -> Result<(), Error>
&self,
content_buffer: &P,
format: &Atom,
iter: &mut TextIter,
data: &[u8]
) -> Result<(), Error>
This function deserializes rich text in format format
and inserts
it at iter
.
formats
to be used must be registered using
TextBufferExt::register_deserialize_format
or
TextBufferExt::register_deserialize_tagset
beforehand.
content_buffer
the TextBuffer
to deserialize into
format
the rich text format to use for deserializing
iter
insertion point for the deserialized text
data
data to deserialize
length
length of data
Returns
true
on success, false
otherwise.
fn deserialize_get_can_create_tags(&self, format: &Atom) -> bool
This functions returns the value set with
TextBufferExt::deserialize_set_can_create_tags
format
a gdk::Atom
representing a registered rich text format
Returns
whether deserializing this format may create tags
fn deserialize_set_can_create_tags(&self, format: &Atom, can_create_tags: bool)
Use this function to allow a rich text deserialization function to create new tags in the receiving buffer. Note that using this function is almost always a bad idea, because the rich text functions you register should know how to map the rich text format they handler to your text buffers set of tags.
The ability of creating new (arbitrary!) tags in the receiving buffer
is meant for special rich text formats like the internal one that
is registered using TextBufferExt::register_deserialize_tagset
,
because that format is essentially a dump of the internal structure
of the source buffer, including its tag names.
You should allow creation of tags only if you know what you are doing, e.g. if you defined a tagset name for your application suite’s text buffers and you know that it’s fine to receive new tags from these buffers, because you know that your application can handle the newly created tags.
format
a gdk::Atom
representing a registered rich text format
can_create_tags
whether deserializing this format may create tags
fn end_user_action(&self)
Should be paired with a call to TextBufferExt::begin_user_action
.
See that function for a full explanation.
fn get_bounds(&self) -> (TextIter, TextIter)
Retrieves the first and last iterators in the buffer, i.e. the
entire buffer lies within the range [start
,end
).
start
iterator to initialize with first position in the buffer
end
iterator to initialize with the end iterator
fn get_char_count(&self) -> i32
Gets the number of characters in the buffer; note that characters and bytes are not the same, you can’t e.g. expect the contents of the buffer in string form to be this many bytes long. The character count is cached, so this function is very fast.
Returns
number of characters in the buffer
fn get_copy_target_list(&self) -> Option<TargetList>
This function returns the list of targets this text buffer can
provide for copying and as DND source. The targets in the list are
added with info
values from the TextBufferTargetInfo
enum,
using TargetList::add_rich_text_targets
and
TargetList::add_text_targets
.
Returns
the TargetList
fn get_deserialize_formats(&self) -> Vec<Atom>
This function returns the rich text deserialize formats registered
with self
using TextBufferExt::register_deserialize_format
or
TextBufferExt::register_deserialize_tagset
n_formats
return location for the number of formats
Returns
an array of
GdkAtoms
representing the registered formats.
fn get_end_iter(&self) -> TextIter
Initializes iter
with the “end iterator,” one past the last valid
character in the text buffer. If dereferenced with
TextIter::get_char
, the end iterator has a character value of 0.
The entire buffer lies in the range from the first position in
the buffer (call TextBufferExt::get_start_iter
to get
character position 0) to the end iterator.
iter
iterator to initialize
fn get_has_selection(&self) -> bool
Indicates whether the buffer has some text currently selected.
Returns
true
if the there is text selected
fn get_insert(&self) -> Option<TextMark>
Returns the mark that represents the cursor (insertion point).
Equivalent to calling TextBufferExt::get_mark
to get the mark
named “insert”, but very slightly more efficient, and involves less
typing.
Returns
insertion point mark
fn get_iter_at_child_anchor<P: IsA<TextChildAnchor>>(
&self,
anchor: &P
) -> TextIter
&self,
anchor: &P
) -> TextIter
Obtains the location of anchor
within self
.
iter
an iterator to be initialized
anchor
a child anchor that appears in self
fn get_iter_at_line(&self, line_number: i32) -> TextIter
Initializes iter
to the start of the given line. If line_number
is greater
than the number of lines in the self
, the end iterator is returned.
iter
iterator to initialize
line_number
line number counting from 0
fn get_iter_at_line_index(&self, line_number: i32, byte_index: i32) -> TextIter
Obtains an iterator pointing to byte_index
within the given line.
byte_index
must be the start of a UTF-8 character. Note bytes, not
characters; UTF-8 may encode one character as multiple bytes.
Before the 3.20 version, it was not allowed to pass an invalid location.
Since the 3.20 version, if line_number
is greater than the number of lines
in the self
, the end iterator is returned. And if byte_index
is off the
end of the line, the iterator at the end of the line is returned.
iter
iterator to initialize
line_number
line number counting from 0
byte_index
byte index from start of line
fn get_iter_at_line_offset(
&self,
line_number: i32,
char_offset: i32
) -> TextIter
&self,
line_number: i32,
char_offset: i32
) -> TextIter
Obtains an iterator pointing to char_offset
within the given line. Note
characters, not bytes; UTF-8 may encode one character as multiple bytes.
Before the 3.20 version, it was not allowed to pass an invalid location.
Since the 3.20 version, if line_number
is greater than the number of lines
in the self
, the end iterator is returned. And if char_offset
is off the
end of the line, the iterator at the end of the line is returned.
iter
iterator to initialize
line_number
line number counting from 0
char_offset
char offset from start of line
fn get_iter_at_mark<P: IsA<TextMark>>(&self, mark: &P) -> TextIter
Initializes iter
with the current position of mark
.
iter
iterator to initialize
mark
a TextMark
in self
fn get_iter_at_offset(&self, char_offset: i32) -> TextIter
Initializes iter
to a position char_offset
chars from the start
of the entire buffer. If char_offset
is -1 or greater than the number
of characters in the buffer, iter
is initialized to the end iterator,
the iterator one past the last valid character in the buffer.
iter
iterator to initialize
char_offset
char offset from start of buffer, counting from 0, or -1
fn get_line_count(&self) -> i32
Obtains the number of lines in the buffer. This value is cached, so the function is very fast.
Returns
number of lines in the buffer
fn get_mark(&self, name: &str) -> Option<TextMark>
Returns the mark named name
in buffer self
, or None
if no such
mark exists in the buffer.
name
a mark name
Returns
a TextMark
, or None
fn get_modified(&self) -> bool
Indicates whether the buffer has been modified since the last call
to TextBufferExt::set_modified
set the modification flag to
false
. Used for example to enable a “save” function in a text
editor.
Returns
true
if the buffer has been modified
fn get_paste_target_list(&self) -> Option<TargetList>
This function returns the list of targets this text buffer supports
for pasting and as DND destination. The targets in the list are
added with info
values from the TextBufferTargetInfo
enum,
using TargetList::add_rich_text_targets
and
TargetList::add_text_targets
.
Returns
the TargetList
fn get_selection_bound(&self) -> Option<TextMark>
Returns the mark that represents the selection bound. Equivalent
to calling TextBufferExt::get_mark
to get the mark named
“selection_bound”, but very slightly more efficient, and involves
less typing.
The currently-selected text in self
is the region between the
“selection_bound” and “insert” marks. If “selection_bound” and
“insert” are in the same place, then there is no current selection.
TextBufferExt::get_selection_bounds
is another convenient function
for handling the selection, if you just want to know whether there’s a
selection and what its bounds are.
Returns
selection bound mark
fn get_selection_bounds(&self) -> Option<(TextIter, TextIter)>
Returns true
if some text is selected; places the bounds
of the selection in start
and end
(if the selection has length 0,
then start
and end
are filled in with the same value).
start
and end
will be in ascending order. If start
and end
are
NULL, then they are not filled in, but the return value still indicates
whether text is selected.
start
iterator to initialize with selection start
end
iterator to initialize with selection end
Returns
whether the selection has nonzero length
fn get_serialize_formats(&self) -> Vec<Atom>
This function returns the rich text serialize formats registered
with self
using TextBuffer::register_serialize_format
or
TextBufferExt::register_serialize_tagset
n_formats
return location for the number of formats
Returns
an array of
GdkAtoms
representing the registered formats.
fn get_slice(
&self,
start: &TextIter,
end: &TextIter,
include_hidden_chars: bool
) -> Option<GString>
&self,
start: &TextIter,
end: &TextIter,
include_hidden_chars: bool
) -> Option<GString>
Returns the text in the range [start
,end
). Excludes undisplayed
text (text marked with tags that set the invisibility attribute) if
include_hidden_chars
is false
. The returned string includes a
0xFFFC character whenever the buffer contains
embedded images, so byte and character indexes into
the returned string do correspond to byte
and character indexes into the buffer. Contrast with
TextBufferExt::get_text
. Note that 0xFFFC can occur in normal
text as well, so it is not a reliable indicator that a pixbuf or
widget is in the buffer.
start
start of a range
end
end of a range
include_hidden_chars
whether to include invisible text
Returns
an allocated UTF-8 string
fn get_start_iter(&self) -> TextIter
Initialized iter
with the first position in the text buffer. This
is the same as using TextBufferExt::get_iter_at_offset
to get
the iter at character offset 0.
iter
iterator to initialize
fn get_tag_table(&self) -> Option<TextTagTable>
fn get_text(
&self,
start: &TextIter,
end: &TextIter,
include_hidden_chars: bool
) -> Option<GString>
&self,
start: &TextIter,
end: &TextIter,
include_hidden_chars: bool
) -> Option<GString>
Returns the text in the range [start
,end
). Excludes undisplayed
text (text marked with tags that set the invisibility attribute) if
include_hidden_chars
is false
. Does not include characters
representing embedded images, so byte and character indexes into
the returned string do not correspond to byte
and character indexes into the buffer. Contrast with
TextBufferExt::get_slice
.
start
start of a range
end
end of a range
include_hidden_chars
whether to include invisible text
Returns
an allocated UTF-8 string
fn insert(&self, iter: &mut TextIter, text: &str)
Inserts len
bytes of text
at position iter
. If len
is -1,
text
must be nul-terminated and will be inserted in its
entirety. Emits the “insert-text” signal; insertion actually occurs
in the default handler for the signal. iter
is invalidated when
insertion occurs (because the buffer contents change), but the
default signal handler revalidates it to point to the end of the
inserted text.
iter
a position in the buffer
text
text in UTF-8 format
len
length of text in bytes, or -1
fn insert_at_cursor(&self, text: &str)
Simply calls TextBufferExt::insert
, using the current
cursor position as the insertion point.
text
text in UTF-8 format
len
length of text, in bytes
fn insert_child_anchor<P: IsA<TextChildAnchor>>(
&self,
iter: &mut TextIter,
anchor: &P
)
&self,
iter: &mut TextIter,
anchor: &P
)
Inserts a child widget anchor into the text buffer at iter
. The
anchor will be counted as one character in character counts, and
when obtaining the buffer contents as a string, will be represented
by the Unicode “object replacement character” 0xFFFC. Note that the
“slice” variants for obtaining portions of the buffer as a string
include this character for child anchors, but the “text” variants do
not. E.g. see TextBufferExt::get_slice
and
TextBufferExt::get_text
. Consider
TextBufferExt::create_child_anchor
as a more convenient
alternative to this function. The buffer will add a reference to
the anchor, so you can unref it after insertion.
iter
location to insert the anchor
anchor
a TextChildAnchor
fn insert_interactive(
&self,
iter: &mut TextIter,
text: &str,
default_editable: bool
) -> bool
&self,
iter: &mut TextIter,
text: &str,
default_editable: bool
) -> bool
Like TextBufferExt::insert
, but the insertion will not occur if
iter
is at a non-editable location in the buffer. Usually you
want to prevent insertions at ineditable locations if the insertion
results from a user action (is interactive).
default_editable
indicates the editability of text that doesn't
have a tag affecting editability applied to it. Typically the
result of TextViewExt::get_editable
is appropriate here.
iter
a position in self
text
some UTF-8 text
len
length of text in bytes, or -1
default_editable
default editability of buffer
Returns
whether text was actually inserted
fn insert_interactive_at_cursor(
&self,
text: &str,
default_editable: bool
) -> bool
&self,
text: &str,
default_editable: bool
) -> bool
Calls TextBufferExt::insert_interactive
at the cursor
position.
default_editable
indicates the editability of text that doesn't
have a tag affecting editability applied to it. Typically the
result of TextViewExt::get_editable
is appropriate here.
text
text in UTF-8 format
len
length of text in bytes, or -1
default_editable
default editability of buffer
Returns
whether text was actually inserted
fn insert_markup(&self, iter: &mut TextIter, markup: &str)
Inserts the text in markup
at position iter
. markup
will be inserted
in its entirety and must be nul-terminated and valid UTF-8. Emits the
TextBuffer::insert-text
signal, possibly multiple times; insertion
actually occurs in the default handler for the signal. iter
will point
to the end of the inserted text on return.
Feature: v3_16
iter
location to insert the markup
markup
a nul-terminated UTF-8 string containing [Pango markup][PangoMarkupFormat]
len
length of markup
in bytes, or -1
fn insert_pixbuf(&self, iter: &mut TextIter, pixbuf: &Pixbuf)
Inserts an image into the text buffer at iter
. The image will be
counted as one character in character counts, and when obtaining
the buffer contents as a string, will be represented by the Unicode
“object replacement character” 0xFFFC. Note that the “slice”
variants for obtaining portions of the buffer as a string include
this character for pixbufs, but the “text” variants do
not. e.g. see TextBufferExt::get_slice
and
TextBufferExt::get_text
.
iter
location to insert the pixbuf
pixbuf
a gdk_pixbuf::Pixbuf
fn insert_range(&self, iter: &mut TextIter, start: &TextIter, end: &TextIter)
Copies text, tags, and pixbufs between start
and end
(the order
of start
and end
doesn’t matter) and inserts the copy at iter
.
Used instead of simply getting/inserting text because it preserves
images and tags. If start
and end
are in a different buffer from
self
, the two buffers must share the same tag table.
Implemented via emissions of the insert_text and apply_tag signals, so expect those.
iter
a position in self
start
a position in a TextBuffer
end
another position in the same buffer as start
fn insert_range_interactive(
&self,
iter: &mut TextIter,
start: &TextIter,
end: &TextIter,
default_editable: bool
) -> bool
&self,
iter: &mut TextIter,
start: &TextIter,
end: &TextIter,
default_editable: bool
) -> bool
Same as TextBufferExt::insert_range
, but does nothing if the
insertion point isn’t editable. The default_editable
parameter
indicates whether the text is editable at iter
if no tags
enclosing iter
affect editability. Typically the result of
TextViewExt::get_editable
is appropriate here.
iter
a position in self
start
a position in a TextBuffer
end
another position in the same buffer as start
default_editable
default editability of the buffer
Returns
whether an insertion was possible at iter
fn move_mark<P: IsA<TextMark>>(&self, mark: &P, where_: &TextIter)
Moves mark
to the new location where_
. Emits the TextBuffer::mark-set
signal as notification of the move.
mark
a TextMark
where_
new location for mark
in self
fn move_mark_by_name(&self, name: &str, where_: &TextIter)
Moves the mark named name
(which must exist) to location where_
.
See TextBufferExt::move_mark
for details.
name
name of a mark
where_
new location for mark
fn paste_clipboard(
&self,
clipboard: &Clipboard,
override_location: Option<&TextIter>,
default_editable: bool
)
&self,
clipboard: &Clipboard,
override_location: Option<&TextIter>,
default_editable: bool
)
Pastes the contents of a clipboard. If override_location
is None
, the
pasted text will be inserted at the cursor position, or the buffer selection
will be replaced if the selection is non-empty.
Note: pasting is asynchronous, that is, we’ll ask for the paste data and return, and at some point later after the main loop runs, the paste data will be inserted.
clipboard
the Clipboard
to paste from
override_location
location to insert pasted text, or None
default_editable
whether the buffer is editable by default
fn place_cursor(&self, where_: &TextIter)
This function moves the “insert” and “selection_bound” marks
simultaneously. If you move them to the same place in two steps
with TextBufferExt::move_mark
, you will temporarily select a
region in between their old and new locations, which can be pretty
inefficient since the temporarily-selected region will force stuff
to be recalculated. This function moves them as a unit, which can
be optimized.
where_
where to put the cursor
fn register_deserialize_tagset(&self, tagset_name: Option<&str>) -> Atom
This function registers GTK+’s internal rich text serialization
format with the passed self
. See
TextBufferExt::register_serialize_tagset
for details.
tagset_name
an optional tagset name, on None
Returns
the gdk::Atom
that corresponds to the
newly registered format’s mime-type.
fn register_serialize_tagset(&self, tagset_name: Option<&str>) -> Atom
This function registers GTK+’s internal rich text serialization
format with the passed self
. The internal format does not comply
to any standard rich text format and only works between TextBuffer
instances. It is capable of serializing all of a text buffer’s tags
and embedded pixbufs.
This function is just a wrapper around
TextBuffer::register_serialize_format
. The mime type used
for registering is “application/x-gtk-text-buffer-rich-text”, or
“application/x-gtk-text-buffer-rich-text;format=tagset_name
” if a
tagset_name
was passed.
The tagset_name
can be used to restrict the transfer of rich text
to buffers with compatible sets of tags, in order to avoid unknown
tags from being pasted. It is probably the common case to pass an
identifier != None
here, since the None
tagset requires the
receiving buffer to deal with with pasting of arbitrary tags.
tagset_name
an optional tagset name, on None
Returns
the gdk::Atom
that corresponds to the
newly registered format’s mime-type.
fn remove_all_tags(&self, start: &TextIter, end: &TextIter)
Removes all tags in the range between start
and end
. Be careful
with this function; it could remove tags added in code unrelated to
the code you’re currently writing. That is, using this function is
probably a bad idea if you have two or more unrelated code sections
that add tags.
start
one bound of range to be untagged
end
other bound of range to be untagged
fn remove_selection_clipboard(&self, clipboard: &Clipboard)
Removes a Clipboard
added with
TextBufferExt::add_selection_clipboard
.
clipboard
a Clipboard
added to self
by
TextBufferExt::add_selection_clipboard
fn remove_tag<P: IsA<TextTag>>(&self, tag: &P, start: &TextIter, end: &TextIter)
Emits the “remove-tag” signal. The default handler for the signal
removes all occurrences of tag
from the given range. start
and
end
don’t have to be in order.
tag
a TextTag
start
one bound of range to be untagged
end
other bound of range to be untagged
fn remove_tag_by_name(&self, name: &str, start: &TextIter, end: &TextIter)
Calls TextTagTableExt::lookup
on the buffer’s tag table to
get a TextTag
, then calls TextBufferExt::remove_tag
.
name
name of a TextTag
start
one bound of range to be untagged
end
other bound of range to be untagged
fn select_range(&self, ins: &TextIter, bound: &TextIter)
This function moves the “insert” and “selection_bound” marks
simultaneously. If you move them in two steps
with TextBufferExt::move_mark
, you will temporarily select a
region in between their old and new locations, which can be pretty
inefficient since the temporarily-selected region will force stuff
to be recalculated. This function moves them as a unit, which can
be optimized.
ins
where to put the “insert” mark
bound
where to put the “selection_bound” mark
fn serialize<P: IsA<TextBuffer>>(
&self,
content_buffer: &P,
format: &Atom,
start: &TextIter,
end: &TextIter
) -> Vec<u8>
&self,
content_buffer: &P,
format: &Atom,
start: &TextIter,
end: &TextIter
) -> Vec<u8>
This function serializes the portion of text between start
and end
in the rich text format represented by format
.
formats
to be used must be registered using
TextBuffer::register_serialize_format
or
TextBufferExt::register_serialize_tagset
beforehand.
content_buffer
the TextBuffer
to serialize
format
the rich text format to use for serializing
start
start of block of text to serialize
end
end of block of test to serialize
length
return location for the length of the serialized data
Returns
the serialized
data, encoded as format
fn set_modified(&self, setting: bool)
Used to keep track of whether the buffer has been modified since the
last time it was saved. Whenever the buffer is saved to disk, call
gtk_text_buffer_set_modified (self
, FALSE). When the buffer is modified,
it will automatically toggled on the modified bit again. When the modified
bit flips, the buffer emits the TextBuffer::modified-changed
signal.
setting
modification flag setting
fn set_text(&self, text: &str)
Deletes current contents of self
, and inserts text
instead. If
len
is -1, text
must be nul-terminated. text
must be valid UTF-8.
text
UTF-8 text to insert
len
length of text
in bytes
fn unregister_deserialize_format(&self, format: &Atom)
This function unregisters a rich text format that was previously
registered using TextBufferExt::register_deserialize_format
or
TextBufferExt::register_deserialize_tagset
.
format
a gdk::Atom
representing a registered rich text format.
fn unregister_serialize_format(&self, format: &Atom)
This function unregisters a rich text format that was previously
registered using TextBuffer::register_serialize_format
or
TextBufferExt::register_serialize_tagset
format
a gdk::Atom
representing a registered rich text format.
fn get_property_cursor_position(&self) -> i32
The position of the insert mark (as offset from the beginning of the buffer). It is useful for getting notified when the cursor moves.
fn connect_begin_user_action<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
The ::begin-user-action signal is emitted at the beginning of a single
user-visible operation on a TextBuffer
.
See also:
TextBufferExt::begin_user_action
,
TextBufferExt::insert_interactive
,
TextBufferExt::insert_range_interactive
,
TextBufferExt::delete_interactive
,
TextBufferExt::backspace
,
TextBufferExt::delete_selection
.
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
The ::changed signal is emitted when the content of a TextBuffer
has changed.
fn connect_end_user_action<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
The ::end-user-action signal is emitted at the end of a single
user-visible operation on the TextBuffer
.
See also:
TextBufferExt::end_user_action
,
TextBufferExt::insert_interactive
,
TextBufferExt::insert_range_interactive
,
TextBufferExt::delete_interactive
,
TextBufferExt::backspace
,
TextBufferExt::delete_selection
,
TextBufferExt::backspace
.
fn connect_mark_deleted<F: Fn(&Self, &TextMark) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
The ::mark-deleted signal is emitted as notification
after a TextMark
is deleted.
See also:
TextBufferExt::delete_mark
.
mark
The mark that was deleted
fn connect_mark_set<F: Fn(&Self, &TextIter, &TextMark) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
The ::mark-set signal is emitted as notification
after a TextMark
is set.
See also:
TextBufferExt::create_mark
,
TextBufferExt::move_mark
.
location
The location of mark
in textbuffer
mark
The mark that is set
fn connect_modified_changed<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
The ::modified-changed signal is emitted when the modified bit of a
TextBuffer
flips.
See also:
TextBufferExt::set_modified
.
fn connect_paste_done<F: Fn(&Self, &Clipboard) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
The paste-done signal is emitted after paste operation has been completed.
This is useful to properly scroll the view to the end of the pasted text.
See TextBufferExt::paste_clipboard
for more details.
clipboard
the Clipboard
pasted from
fn connect_property_copy_target_list_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
fn connect_property_cursor_position_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
fn connect_property_has_selection_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
fn connect_property_paste_target_list_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
fn connect_property_text_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
Implementors
impl<O: IsA<TextBuffer>> TextBufferExt for O
[src]
fn add_mark<P: IsA<TextMark>>(&self, mark: &P, where_: &TextIter)
[src]
fn add_selection_clipboard(&self, clipboard: &Clipboard)
[src]
fn apply_tag<P: IsA<TextTag>>(&self, tag: &P, start: &TextIter, end: &TextIter)
[src]
fn apply_tag_by_name(&self, name: &str, start: &TextIter, end: &TextIter)
[src]
fn backspace(
&self,
iter: &mut TextIter,
interactive: bool,
default_editable: bool
) -> bool
[src]
&self,
iter: &mut TextIter,
interactive: bool,
default_editable: bool
) -> bool
fn begin_user_action(&self)
[src]
fn copy_clipboard(&self, clipboard: &Clipboard)
[src]
fn create_child_anchor(&self, iter: &mut TextIter) -> Option<TextChildAnchor>
[src]
fn create_mark(
&self,
mark_name: Option<&str>,
where_: &TextIter,
left_gravity: bool
) -> Option<TextMark>
[src]
&self,
mark_name: Option<&str>,
where_: &TextIter,
left_gravity: bool
) -> Option<TextMark>
fn cut_clipboard(&self, clipboard: &Clipboard, default_editable: bool)
[src]
fn delete(&self, start: &mut TextIter, end: &mut TextIter)
[src]
fn delete_interactive(
&self,
start_iter: &mut TextIter,
end_iter: &mut TextIter,
default_editable: bool
) -> bool
[src]
&self,
start_iter: &mut TextIter,
end_iter: &mut TextIter,
default_editable: bool
) -> bool
fn delete_mark<P: IsA<TextMark>>(&self, mark: &P)
[src]
fn delete_mark_by_name(&self, name: &str)
[src]
fn delete_selection(&self, interactive: bool, default_editable: bool) -> bool
[src]
fn deserialize<P: IsA<TextBuffer>>(
&self,
content_buffer: &P,
format: &Atom,
iter: &mut TextIter,
data: &[u8]
) -> Result<(), Error>
[src]
&self,
content_buffer: &P,
format: &Atom,
iter: &mut TextIter,
data: &[u8]
) -> Result<(), Error>
fn deserialize_get_can_create_tags(&self, format: &Atom) -> bool
[src]
fn deserialize_set_can_create_tags(&self, format: &Atom, can_create_tags: bool)
[src]
fn end_user_action(&self)
[src]
fn get_bounds(&self) -> (TextIter, TextIter)
[src]
fn get_char_count(&self) -> i32
[src]
fn get_copy_target_list(&self) -> Option<TargetList>
[src]
fn get_deserialize_formats(&self) -> Vec<Atom>
[src]
fn get_end_iter(&self) -> TextIter
[src]
fn get_has_selection(&self) -> bool
[src]
fn get_insert(&self) -> Option<TextMark>
[src]
fn get_iter_at_child_anchor<P: IsA<TextChildAnchor>>(
&self,
anchor: &P
) -> TextIter
[src]
&self,
anchor: &P
) -> TextIter
fn get_iter_at_line(&self, line_number: i32) -> TextIter
[src]
fn get_iter_at_line_index(&self, line_number: i32, byte_index: i32) -> TextIter
[src]
fn get_iter_at_line_offset(
&self,
line_number: i32,
char_offset: i32
) -> TextIter
[src]
&self,
line_number: i32,
char_offset: i32
) -> TextIter
fn get_iter_at_mark<P: IsA<TextMark>>(&self, mark: &P) -> TextIter
[src]
fn get_iter_at_offset(&self, char_offset: i32) -> TextIter
[src]
fn get_line_count(&self) -> i32
[src]
fn get_mark(&self, name: &str) -> Option<TextMark>
[src]
fn get_modified(&self) -> bool
[src]
fn get_paste_target_list(&self) -> Option<TargetList>
[src]
fn get_selection_bound(&self) -> Option<TextMark>
[src]
fn get_selection_bounds(&self) -> Option<(TextIter, TextIter)>
[src]
fn get_serialize_formats(&self) -> Vec<Atom>
[src]
fn get_slice(
&self,
start: &TextIter,
end: &TextIter,
include_hidden_chars: bool
) -> Option<GString>
[src]
&self,
start: &TextIter,
end: &TextIter,
include_hidden_chars: bool
) -> Option<GString>
fn get_start_iter(&self) -> TextIter
[src]
fn get_tag_table(&self) -> Option<TextTagTable>
[src]
fn get_text(
&self,
start: &TextIter,
end: &TextIter,
include_hidden_chars: bool
) -> Option<GString>
[src]
&self,
start: &TextIter,
end: &TextIter,
include_hidden_chars: bool
) -> Option<GString>
fn insert(&self, iter: &mut TextIter, text: &str)
[src]
fn insert_at_cursor(&self, text: &str)
[src]
fn insert_child_anchor<P: IsA<TextChildAnchor>>(
&self,
iter: &mut TextIter,
anchor: &P
)
[src]
&self,
iter: &mut TextIter,
anchor: &P
)
fn insert_interactive(
&self,
iter: &mut TextIter,
text: &str,
default_editable: bool
) -> bool
[src]
&self,
iter: &mut TextIter,
text: &str,
default_editable: bool
) -> bool
fn insert_interactive_at_cursor(
&self,
text: &str,
default_editable: bool
) -> bool
[src]
&self,
text: &str,
default_editable: bool
) -> bool
fn insert_markup(&self, iter: &mut TextIter, markup: &str)
[src]
fn insert_pixbuf(&self, iter: &mut TextIter, pixbuf: &Pixbuf)
[src]
fn insert_range(&self, iter: &mut TextIter, start: &TextIter, end: &TextIter)
[src]
fn insert_range_interactive(
&self,
iter: &mut TextIter,
start: &TextIter,
end: &TextIter,
default_editable: bool
) -> bool
[src]
&self,
iter: &mut TextIter,
start: &TextIter,
end: &TextIter,
default_editable: bool
) -> bool
fn move_mark<P: IsA<TextMark>>(&self, mark: &P, where_: &TextIter)
[src]
fn move_mark_by_name(&self, name: &str, where_: &TextIter)
[src]
fn paste_clipboard(
&self,
clipboard: &Clipboard,
override_location: Option<&TextIter>,
default_editable: bool
)
[src]
&self,
clipboard: &Clipboard,
override_location: Option<&TextIter>,
default_editable: bool
)
fn place_cursor(&self, where_: &TextIter)
[src]
fn register_deserialize_tagset(&self, tagset_name: Option<&str>) -> Atom
[src]
fn register_serialize_tagset(&self, tagset_name: Option<&str>) -> Atom
[src]
fn remove_all_tags(&self, start: &TextIter, end: &TextIter)
[src]
fn remove_selection_clipboard(&self, clipboard: &Clipboard)
[src]
fn remove_tag<P: IsA<TextTag>>(&self, tag: &P, start: &TextIter, end: &TextIter)
[src]
fn remove_tag_by_name(&self, name: &str, start: &TextIter, end: &TextIter)
[src]
fn select_range(&self, ins: &TextIter, bound: &TextIter)
[src]
fn serialize<P: IsA<TextBuffer>>(
&self,
content_buffer: &P,
format: &Atom,
start: &TextIter,
end: &TextIter
) -> Vec<u8>
[src]
&self,
content_buffer: &P,
format: &Atom,
start: &TextIter,
end: &TextIter
) -> Vec<u8>
fn set_modified(&self, setting: bool)
[src]
fn set_text(&self, text: &str)
[src]
fn unregister_deserialize_format(&self, format: &Atom)
[src]
fn unregister_serialize_format(&self, format: &Atom)
[src]
fn get_property_cursor_position(&self) -> i32
[src]
fn connect_begin_user_action<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
[src]
fn connect_end_user_action<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_mark_deleted<F: Fn(&Self, &TextMark) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_mark_set<F: Fn(&Self, &TextIter, &TextMark) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_modified_changed<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_paste_done<F: Fn(&Self, &Clipboard) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_copy_target_list_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_cursor_position_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_has_selection_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_paste_target_list_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_text_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId