Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- Exported types
- Methods
- addMark
- addSelectionClipboard
- applyTag
- applyTagByName
- backspace
- beginIrreversibleAction
- beginUserAction
- copyClipboard
- createChildAnchor
- createMark
- cutClipboard
- delete
- deleteInteractive
- deleteMark
- deleteMarkByName
- deleteSelection
- endIrreversibleAction
- endUserAction
- getBounds
- getCanRedo
- getCanUndo
- getCharCount
- getEnableUndo
- getEndIter
- getHasSelection
- getInsert
- getIterAtChildAnchor
- getIterAtLine
- getIterAtLineIndex
- getIterAtLineOffset
- getIterAtMark
- getIterAtOffset
- getLineCount
- getMark
- getMaxUndoLevels
- getModified
- getSelectionBound
- getSelectionBounds
- getSelectionContent
- getSlice
- getStartIter
- getTagTable
- getText
- insert
- insertAtCursor
- insertChildAnchor
- insertInteractive
- insertInteractiveAtCursor
- insertMarkup
- insertPaintable
- insertRange
- insertRangeInteractive
- moveMark
- moveMarkByName
- new
- pasteClipboard
- placeCursor
- redo
- removeAllTags
- removeSelectionClipboard
- removeTag
- removeTagByName
- selectRange
- setEnableUndo
- setMaxUndoLevels
- setModified
- setText
- undo
- Properties
- Signals
Stores text and attributes for display in a GtkTextView
.
You may wish to begin by reading the text widget conceptual overview, which gives an overview of all the objects and data types related to the text widget and how they work together.
GtkTextBuffer can support undoing changes to the buffer
content, see textBufferSetEnableUndo
.
Synopsis
- newtype TextBuffer = TextBuffer (ManagedPtr TextBuffer)
- class (GObject o, IsDescendantOf TextBuffer o) => IsTextBuffer o
- toTextBuffer :: (MonadIO m, IsTextBuffer o) => o -> m TextBuffer
- textBufferAddMark :: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextMark b) => a -> b -> TextIter -> m ()
- textBufferAddSelectionClipboard :: (HasCallStack, MonadIO m, IsTextBuffer a, IsClipboard b) => a -> b -> m ()
- textBufferApplyTag :: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextTag b) => a -> b -> TextIter -> TextIter -> m ()
- textBufferApplyTagByName :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Text -> TextIter -> TextIter -> m ()
- textBufferBackspace :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> Bool -> Bool -> m Bool
- textBufferBeginIrreversibleAction :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m ()
- textBufferBeginUserAction :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m ()
- textBufferCopyClipboard :: (HasCallStack, MonadIO m, IsTextBuffer a, IsClipboard b) => a -> b -> m ()
- textBufferCreateChildAnchor :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> m TextChildAnchor
- textBufferCreateMark :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Maybe Text -> TextIter -> Bool -> m TextMark
- textBufferCutClipboard :: (HasCallStack, MonadIO m, IsTextBuffer a, IsClipboard b) => a -> b -> Bool -> m ()
- textBufferDelete :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> TextIter -> m ()
- textBufferDeleteInteractive :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> TextIter -> Bool -> m Bool
- textBufferDeleteMark :: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextMark b) => a -> b -> m ()
- textBufferDeleteMarkByName :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Text -> m ()
- textBufferDeleteSelection :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Bool -> Bool -> m Bool
- textBufferEndIrreversibleAction :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m ()
- textBufferEndUserAction :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m ()
- textBufferGetBounds :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m (TextIter, TextIter)
- textBufferGetCanRedo :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m Bool
- textBufferGetCanUndo :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m Bool
- textBufferGetCharCount :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m Int32
- textBufferGetEnableUndo :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m Bool
- textBufferGetEndIter :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m TextIter
- textBufferGetHasSelection :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m Bool
- textBufferGetInsert :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m TextMark
- textBufferGetIterAtChildAnchor :: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextChildAnchor b) => a -> b -> m TextIter
- textBufferGetIterAtLine :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Int32 -> m (Bool, TextIter)
- textBufferGetIterAtLineIndex :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Int32 -> Int32 -> m (Bool, TextIter)
- textBufferGetIterAtLineOffset :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Int32 -> Int32 -> m (Bool, TextIter)
- textBufferGetIterAtMark :: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextMark b) => a -> b -> m TextIter
- textBufferGetIterAtOffset :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Int32 -> m TextIter
- textBufferGetLineCount :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m Int32
- textBufferGetMark :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Text -> m (Maybe TextMark)
- textBufferGetMaxUndoLevels :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m Word32
- textBufferGetModified :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m Bool
- textBufferGetSelectionBound :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m TextMark
- textBufferGetSelectionBounds :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m (Bool, TextIter, TextIter)
- textBufferGetSelectionContent :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m ContentProvider
- textBufferGetSlice :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> TextIter -> Bool -> m Text
- textBufferGetStartIter :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m TextIter
- textBufferGetTagTable :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m TextTagTable
- textBufferGetText :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> TextIter -> Bool -> m Text
- textBufferInsert :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> Text -> Int32 -> m ()
- textBufferInsertAtCursor :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Text -> Int32 -> m ()
- textBufferInsertChildAnchor :: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextChildAnchor b) => a -> TextIter -> b -> m ()
- textBufferInsertInteractive :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> Text -> Int32 -> Bool -> m Bool
- textBufferInsertInteractiveAtCursor :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Text -> Int32 -> Bool -> m Bool
- textBufferInsertMarkup :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> Text -> Int32 -> m ()
- textBufferInsertPaintable :: (HasCallStack, MonadIO m, IsTextBuffer a, IsPaintable b) => a -> TextIter -> b -> m ()
- textBufferInsertRange :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> TextIter -> TextIter -> m ()
- textBufferInsertRangeInteractive :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> TextIter -> TextIter -> Bool -> m Bool
- textBufferMoveMark :: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextMark b) => a -> b -> TextIter -> m ()
- textBufferMoveMarkByName :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Text -> TextIter -> m ()
- textBufferNew :: (HasCallStack, MonadIO m, IsTextTagTable a) => Maybe a -> m TextBuffer
- textBufferPasteClipboard :: (HasCallStack, MonadIO m, IsTextBuffer a, IsClipboard b) => a -> b -> Maybe TextIter -> Bool -> m ()
- textBufferPlaceCursor :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> m ()
- textBufferRedo :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m ()
- textBufferRemoveAllTags :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> TextIter -> m ()
- textBufferRemoveSelectionClipboard :: (HasCallStack, MonadIO m, IsTextBuffer a, IsClipboard b) => a -> b -> m ()
- textBufferRemoveTag :: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextTag b) => a -> b -> TextIter -> TextIter -> m ()
- textBufferRemoveTagByName :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Text -> TextIter -> TextIter -> m ()
- textBufferSelectRange :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> TextIter -> TextIter -> m ()
- textBufferSetEnableUndo :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Bool -> m ()
- textBufferSetMaxUndoLevels :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Word32 -> m ()
- textBufferSetModified :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Bool -> m ()
- textBufferSetText :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> Text -> Int32 -> m ()
- textBufferUndo :: (HasCallStack, MonadIO m, IsTextBuffer a) => a -> m ()
- getTextBufferCanRedo :: (MonadIO m, IsTextBuffer o) => o -> m Bool
- getTextBufferCanUndo :: (MonadIO m, IsTextBuffer o) => o -> m Bool
- getTextBufferCursorPosition :: (MonadIO m, IsTextBuffer o) => o -> m Int32
- constructTextBufferEnableUndo :: (IsTextBuffer o, MonadIO m) => Bool -> m (GValueConstruct o)
- getTextBufferEnableUndo :: (MonadIO m, IsTextBuffer o) => o -> m Bool
- setTextBufferEnableUndo :: (MonadIO m, IsTextBuffer o) => o -> Bool -> m ()
- getTextBufferHasSelection :: (MonadIO m, IsTextBuffer o) => o -> m Bool
- constructTextBufferTagTable :: (IsTextBuffer o, MonadIO m, IsTextTagTable a) => a -> m (GValueConstruct o)
- getTextBufferTagTable :: (MonadIO m, IsTextBuffer o) => o -> m TextTagTable
- clearTextBufferText :: (MonadIO m, IsTextBuffer o) => o -> m ()
- constructTextBufferText :: (IsTextBuffer o, MonadIO m) => Text -> m (GValueConstruct o)
- getTextBufferText :: (MonadIO m, IsTextBuffer o) => o -> m (Maybe Text)
- setTextBufferText :: (MonadIO m, IsTextBuffer o) => o -> Text -> m ()
- type TextBufferApplyTagCallback = TextTag -> TextIter -> TextIter -> IO ()
- afterTextBufferApplyTag :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferApplyTagCallback) -> m SignalHandlerId
- onTextBufferApplyTag :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferApplyTagCallback) -> m SignalHandlerId
- type TextBufferBeginUserActionCallback = IO ()
- afterTextBufferBeginUserAction :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferBeginUserActionCallback) -> m SignalHandlerId
- onTextBufferBeginUserAction :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferBeginUserActionCallback) -> m SignalHandlerId
- type TextBufferChangedCallback = IO ()
- afterTextBufferChanged :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferChangedCallback) -> m SignalHandlerId
- onTextBufferChanged :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferChangedCallback) -> m SignalHandlerId
- type TextBufferDeleteRangeCallback = TextIter -> TextIter -> IO ()
- afterTextBufferDeleteRange :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferDeleteRangeCallback) -> m SignalHandlerId
- onTextBufferDeleteRange :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferDeleteRangeCallback) -> m SignalHandlerId
- type TextBufferEndUserActionCallback = IO ()
- afterTextBufferEndUserAction :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferEndUserActionCallback) -> m SignalHandlerId
- onTextBufferEndUserAction :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferEndUserActionCallback) -> m SignalHandlerId
- type TextBufferInsertChildAnchorCallback = TextIter -> TextChildAnchor -> IO ()
- afterTextBufferInsertChildAnchor :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferInsertChildAnchorCallback) -> m SignalHandlerId
- onTextBufferInsertChildAnchor :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferInsertChildAnchorCallback) -> m SignalHandlerId
- type TextBufferInsertPaintableCallback = TextIter -> Paintable -> IO ()
- afterTextBufferInsertPaintable :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferInsertPaintableCallback) -> m SignalHandlerId
- onTextBufferInsertPaintable :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferInsertPaintableCallback) -> m SignalHandlerId
- type TextBufferInsertTextCallback = TextIter -> Text -> Int32 -> IO ()
- afterTextBufferInsertText :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferInsertTextCallback) -> m SignalHandlerId
- onTextBufferInsertText :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferInsertTextCallback) -> m SignalHandlerId
- type TextBufferMarkDeletedCallback = TextMark -> IO ()
- afterTextBufferMarkDeleted :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferMarkDeletedCallback) -> m SignalHandlerId
- onTextBufferMarkDeleted :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferMarkDeletedCallback) -> m SignalHandlerId
- type TextBufferMarkSetCallback = TextIter -> TextMark -> IO ()
- afterTextBufferMarkSet :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferMarkSetCallback) -> m SignalHandlerId
- onTextBufferMarkSet :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferMarkSetCallback) -> m SignalHandlerId
- type TextBufferModifiedChangedCallback = IO ()
- afterTextBufferModifiedChanged :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferModifiedChangedCallback) -> m SignalHandlerId
- onTextBufferModifiedChanged :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferModifiedChangedCallback) -> m SignalHandlerId
- type TextBufferPasteDoneCallback = Clipboard -> IO ()
- afterTextBufferPasteDone :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferPasteDoneCallback) -> m SignalHandlerId
- onTextBufferPasteDone :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferPasteDoneCallback) -> m SignalHandlerId
- type TextBufferRedoCallback = IO ()
- afterTextBufferRedo :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferRedoCallback) -> m SignalHandlerId
- onTextBufferRedo :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferRedoCallback) -> m SignalHandlerId
- type TextBufferRemoveTagCallback = TextTag -> TextIter -> TextIter -> IO ()
- afterTextBufferRemoveTag :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferRemoveTagCallback) -> m SignalHandlerId
- onTextBufferRemoveTag :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferRemoveTagCallback) -> m SignalHandlerId
- type TextBufferUndoCallback = IO ()
- afterTextBufferUndo :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferUndoCallback) -> m SignalHandlerId
- onTextBufferUndo :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferUndoCallback) -> m SignalHandlerId
Exported types
newtype TextBuffer Source #
Memory-managed wrapper type.
TextBuffer (ManagedPtr TextBuffer) |
Instances
Eq TextBuffer Source # | |
Defined in GI.Gtk.Objects.TextBuffer (==) :: TextBuffer -> TextBuffer -> Bool # (/=) :: TextBuffer -> TextBuffer -> Bool # | |
GObject TextBuffer Source # | |
Defined in GI.Gtk.Objects.TextBuffer | |
ManagedPtrNewtype TextBuffer Source # | |
Defined in GI.Gtk.Objects.TextBuffer toManagedPtr :: TextBuffer -> ManagedPtr TextBuffer | |
TypedObject TextBuffer Source # | |
Defined in GI.Gtk.Objects.TextBuffer | |
HasParentTypes TextBuffer Source # | |
Defined in GI.Gtk.Objects.TextBuffer | |
IsGValue (Maybe TextBuffer) Source # | Convert |
Defined in GI.Gtk.Objects.TextBuffer gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe TextBuffer -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe TextBuffer) | |
type ParentTypes TextBuffer Source # | |
Defined in GI.Gtk.Objects.TextBuffer type ParentTypes TextBuffer = '[Object] |
class (GObject o, IsDescendantOf TextBuffer o) => IsTextBuffer o Source #
Type class for types which can be safely cast to TextBuffer
, for instance with toTextBuffer
.
Instances
(GObject o, IsDescendantOf TextBuffer o) => IsTextBuffer o Source # | |
Defined in GI.Gtk.Objects.TextBuffer |
toTextBuffer :: (MonadIO m, IsTextBuffer o) => o -> m TextBuffer Source #
Cast to TextBuffer
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
addMark, addSelectionClipboard, applyTag, applyTagByName, backspace, beginIrreversibleAction, beginUserAction, bindProperty, bindPropertyFull, copyClipboard, createChildAnchor, createMark, cutClipboard, delete, deleteInteractive, deleteMark, deleteMarkByName, deleteSelection, endIrreversibleAction, endUserAction, forceFloating, freezeNotify, getv, insert, insertAtCursor, insertChildAnchor, insertInteractive, insertInteractiveAtCursor, insertMarkup, insertPaintable, insertRange, insertRangeInteractive, isFloating, moveMark, moveMarkByName, notify, notifyByPspec, pasteClipboard, placeCursor, redo, ref, refSink, removeAllTags, removeSelectionClipboard, removeTag, removeTagByName, runDispose, selectRange, stealData, stealQdata, thawNotify, undo, unref, watchClosure.
Getters
getBounds, getCanRedo, getCanUndo, getCharCount, getData, getEnableUndo, getEndIter, getHasSelection, getInsert, getIterAtChildAnchor, getIterAtLine, getIterAtLineIndex, getIterAtLineOffset, getIterAtMark, getIterAtOffset, getLineCount, getMark, getMaxUndoLevels, getModified, getProperty, getQdata, getSelectionBound, getSelectionBounds, getSelectionContent, getSlice, getStartIter, getTagTable, getText.
Setters
setData, setDataFull, setEnableUndo, setMaxUndoLevels, setModified, setProperty, setText.
addMark
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextMark b) | |
=> a |
|
-> b |
|
-> TextIter |
|
-> m () |
Adds the mark at position where
.
The mark must not be added to another buffer, and if its name
is not Nothing
then there must not be another mark in the buffer
with the same name.
Emits the TextBuffer::markSet signal as notification of the mark's initial placement.
addSelectionClipboard
textBufferAddSelectionClipboard Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsClipboard b) | |
=> a |
|
-> b |
|
-> m () |
Adds clipboard
to the list of clipboards in which the selection
contents of buffer
are available.
In most cases, clipboard
will be the GdkClipboard
returned by
widgetGetPrimaryClipboard
for a view of buffer
.
applyTag
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextTag b) | |
=> a |
|
-> b |
|
-> TextIter |
|
-> TextIter |
|
-> m () |
Emits the “apply-tag” signal on buffer
.
The default handler for the signal applies
tag
to the given range. start
and end
do
not have to be in order.
applyTagByName
textBufferApplyTagByName Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Text |
|
-> TextIter |
|
-> TextIter |
|
-> m () |
Emits the “apply-tag” signal on buffer
.
Calls textTagTableLookup
on the buffer’s
tag table to get a GtkTextTag
, then calls
textBufferApplyTag
.
backspace
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> Bool |
|
-> Bool |
|
-> m Bool | Returns: |
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.
beginIrreversibleAction
textBufferBeginIrreversibleAction Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m () |
Denotes the beginning of an action that may not be undone.
This will cause any previous operations in the undo/redo queue to be cleared.
This should be paired with a call to
textBufferEndIrreversibleAction
after the irreversible
action has completed.
You may nest calls to textBufferBeginIrreversibleAction
and textBufferEndIrreversibleAction
pairs.
beginUserAction
textBufferBeginUserAction Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m () |
Called to indicate that the buffer operations between here and a
call to textBufferEndUserAction
are part of a single
user-visible operation.
The operations between textBufferBeginUserAction
and
textBufferEndUserAction
can then be grouped when creating
an undo stack. GtkTextBuffer
maintains a count of calls to
textBufferBeginUserAction
that have not been closed with
a call to textBufferEndUserAction
, 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
textBufferInsertInteractive
, 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.
copyClipboard
textBufferCopyClipboard Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsClipboard b) | |
=> a |
|
-> b |
|
-> m () |
Copies the currently-selected text to a clipboard.
createChildAnchor
textBufferCreateChildAnchor Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> m TextChildAnchor | Returns: the created child anchor |
Creates and inserts a child anchor.
This is a convenience function which simply creates a child anchor
with textChildAnchorNew
and inserts it into the buffer
with textBufferInsertChildAnchor
.
The new anchor is owned by the buffer; no reference count is returned to the caller of this function.
createMark
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Maybe Text |
|
-> TextIter |
|
-> Bool |
|
-> m TextMark | Returns: the new |
Creates a mark at position where
.
If markName
is Nothing
, the mark is anonymous; otherwise, the mark
can be retrieved by name using textBufferGetMark
.
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
(leftGravity
= 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 GtkTextMark
, 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::markSet signal as notification of the mark's initial placement.
cutClipboard
textBufferCutClipboard Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsClipboard b) | |
=> a |
|
-> b |
|
-> Bool |
|
-> m () |
Copies the currently-selected text to a clipboard, then deletes said text if it’s editable.
delete
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> TextIter |
|
-> m () |
Deletes text between start
and end
.
The order of start
and end
is not actually relevant;
textBufferDelete
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.
deleteInteractive
textBufferDeleteInteractive Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> TextIter |
|
-> Bool |
|
-> m Bool | Returns: whether some text was actually deleted |
Deletes all editable text in the given range.
Calls textBufferDelete
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.
deleteMark
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextMark b) | |
=> a |
|
-> b |
|
-> m () |
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 objectRef
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
textBufferAddMark
. Use textMarkGetDeleted
to find out if a mark has been removed from its buffer.
The TextBuffer::markDeleted signal will be emitted as notification after the mark is deleted.
deleteMarkByName
textBufferDeleteMarkByName Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Text |
|
-> m () |
Deletes the mark named name
; the mark must exist.
See textBufferDeleteMark
for details.
deleteSelection
textBufferDeleteSelection Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Bool |
|
-> Bool |
|
-> m Bool | Returns: whether there was a non-empty selection to delete |
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).
endIrreversibleAction
textBufferEndIrreversibleAction Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m () |
Denotes the end of an action that may not be undone.
This will cause any previous operations in the undo/redo queue to be cleared.
This should be called after completing modifications to the
text buffer after textBufferBeginIrreversibleAction
was called.
You may nest calls to textBufferBeginIrreversibleAction
and textBufferEndIrreversibleAction
pairs.
endUserAction
textBufferEndUserAction Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m () |
Ends a user-visible operation.
Should be paired with a call to
textBufferBeginUserAction
.
See that function for a full explanation.
getBounds
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m (TextIter, TextIter) |
Retrieves the first and last iterators in the buffer, i.e. the
entire buffer lies within the range [start
,end
).
getCanRedo
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m Bool | Returns: |
Gets whether there is a redoable action in the history.
getCanUndo
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m Bool | Returns: |
Gets whether there is an undoable action in the history.
getCharCount
textBufferGetCharCount Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m Int32 | Returns: number of characters in the buffer |
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.
getEnableUndo
textBufferGetEnableUndo Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m Bool |
Gets whether the buffer is saving modifications to the buffer to allow for undo and redo actions.
See textBufferBeginIrreversibleAction
and
textBufferEndIrreversibleAction
to create
changes to the buffer that cannot be undone.
getEndIter
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m TextIter |
Initializes iter
with the “end iterator,” one past the last valid
character in the text buffer.
If dereferenced with textIterGetChar
, the end
iterator has a character value of 0.
The entire buffer lies in the range from the first position in
the buffer (call textBufferGetStartIter
to get
character position 0) to the end iterator.
getHasSelection
textBufferGetHasSelection Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m Bool | Returns: |
Indicates whether the buffer has some text currently selected.
getInsert
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m TextMark | Returns: insertion point mark |
Returns the mark that represents the cursor (insertion point).
Equivalent to calling textBufferGetMark
to get the mark named “insert”, but very slightly more
efficient, and involves less typing.
getIterAtChildAnchor
textBufferGetIterAtChildAnchor Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextChildAnchor b) | |
=> a |
|
-> b |
|
-> m TextIter |
Obtains the location of anchor
within buffer
.
getIterAtLine
textBufferGetIterAtLine Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Int32 |
|
-> m (Bool, TextIter) | Returns: whether the exact position has been found |
Initializes iter
to the start of the given line.
If lineNumber
is greater than or equal to the number of lines
in the buffer
, the end iterator is returned.
getIterAtLineIndex
textBufferGetIterAtLineIndex Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> m (Bool, TextIter) | Returns: whether the exact position has been found |
Obtains an iterator pointing to byteIndex
within the given line.
byteIndex
must be the start of a UTF-8 character. Note bytes, not
characters; UTF-8 may encode one character as multiple bytes.
If lineNumber
is greater than or equal to the number of lines in the buffer
,
the end iterator is returned. And if byteIndex
is off the
end of the line, the iterator at the end of the line is returned.
getIterAtLineOffset
textBufferGetIterAtLineOffset Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> m (Bool, TextIter) | Returns: whether the exact position has been found |
Obtains an iterator pointing to charOffset
within the given line.
Note characters, not bytes; UTF-8 may encode one character as multiple bytes.
If lineNumber
is greater than or equal to the number of lines in the buffer
,
the end iterator is returned. And if charOffset
is off the
end of the line, the iterator at the end of the line is returned.
getIterAtMark
textBufferGetIterAtMark Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextMark b) | |
=> a |
|
-> b |
|
-> m TextIter |
Initializes iter
with the current position of mark
.
getIterAtOffset
textBufferGetIterAtOffset Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Int32 |
|
-> m TextIter |
Initializes iter
to a position charOffset
chars from the start
of the entire buffer.
If charOffset
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.
getLineCount
textBufferGetLineCount Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m Int32 | Returns: number of lines in the buffer |
Obtains the number of lines in the buffer.
This value is cached, so the function is very fast.
getMark
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Text |
|
-> m (Maybe TextMark) | Returns: a |
Returns the mark named name
in buffer buffer
, or Nothing
if no such
mark exists in the buffer.
getMaxUndoLevels
textBufferGetMaxUndoLevels Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m Word32 |
Gets the maximum number of undo levels to perform.
If 0, unlimited undo actions may be performed. Note that this may have a memory usage impact as it requires storing an additional copy of the inserted or removed text within the text buffer.
getModified
textBufferGetModified Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m Bool | Returns: |
Indicates whether the buffer has been modified since the last call
to textBufferSetModified
set the modification flag to
False
.
Used for example to enable a “save” function in a text editor.
getSelectionBound
textBufferGetSelectionBound Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m TextMark | Returns: selection bound mark |
Returns the mark that represents the selection bound.
Equivalent to calling textBufferGetMark
to get the mark named “selection_bound”, but very slightly
more efficient, and involves less typing.
The currently-selected text in buffer
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.
textBufferGetSelectionBounds
is another convenient
function for handling the selection, if you just want to know whether
there’s a selection and what its bounds are.
getSelectionBounds
textBufferGetSelectionBounds Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m (Bool, TextIter, TextIter) | Returns: whether the selection has nonzero length |
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 Nothing
, then they are not filled in, but the
return value still indicates whether text is selected.
getSelectionContent
textBufferGetSelectionContent Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m ContentProvider | Returns: a new |
Get a content provider for this buffer.
It can be used to make the content of buffer
available
in a GdkClipboard
, see clipboardSetContent
.
getSlice
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> TextIter |
|
-> Bool |
|
-> m Text | Returns: an allocated UTF-8 string |
Returns the text in the range [start
,end
).
Excludes undisplayed text (text marked with tags that set the
invisibility attribute) if includeHiddenChars
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 textBufferGetText
.
Note that 0xFFFC can occur in normal text as well, so it is not a
reliable indicator that a paintable or widget is in the buffer.
getStartIter
textBufferGetStartIter Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m TextIter |
Initialized iter
with the first position in the text buffer.
This is the same as using textBufferGetIterAtOffset
to get the iter at character offset 0.
getTagTable
textBufferGetTagTable Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m TextTagTable | Returns: the buffer’s tag table |
Get the GtkTextTagTable
associated with this buffer.
getText
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> TextIter |
|
-> Bool |
|
-> m Text | Returns: an allocated UTF-8 string |
Returns the text in the range [start
,end
).
Excludes undisplayed text (text marked with tags that set the
invisibility attribute) if includeHiddenChars
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 textBufferGetSlice
.
insert
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> Text |
|
-> Int32 |
|
-> m () |
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.
insertAtCursor
textBufferInsertAtCursor Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Text |
|
-> Int32 |
|
-> m () |
Inserts text
in buffer
.
Simply calls textBufferInsert
,
using the current cursor position as the insertion point.
insertChildAnchor
textBufferInsertChildAnchor Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextChildAnchor b) | |
=> a |
|
-> TextIter |
|
-> b |
|
-> m () |
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 textBufferGetSlice
and
textBufferGetText
.
Consider textBufferCreateChildAnchor
as a more
convenient alternative to this function. The buffer will add a
reference to the anchor, so you can unref it after insertion.
insertInteractive
textBufferInsertInteractive Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> Text |
|
-> Int32 |
|
-> Bool |
|
-> m Bool | Returns: whether text was actually inserted |
Inserts text
in buffer
.
Like textBufferInsert
, 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).
defaultEditable
indicates the editability of text that doesn't
have a tag affecting editability applied to it. Typically the
result of textViewGetEditable
is appropriate here.
insertInteractiveAtCursor
textBufferInsertInteractiveAtCursor Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Text |
|
-> Int32 |
|
-> Bool |
|
-> m Bool | Returns: whether text was actually inserted |
Inserts text
in buffer
.
Calls textBufferInsertInteractive
at the cursor position.
defaultEditable
indicates the editability of text that doesn't
have a tag affecting editability applied to it. Typically the
result of textViewGetEditable
is appropriate here.
insertMarkup
textBufferInsertMarkup Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> Text |
|
-> Int32 |
|
-> m () |
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::insertText 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.
insertPaintable
textBufferInsertPaintable Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsPaintable b) | |
=> a |
|
-> TextIter |
|
-> b |
|
-> m () |
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 paintable, but the “text”
variants do not. e.g. see textBufferGetSlice
and
textBufferGetText
.
insertRange
textBufferInsertRange Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> TextIter |
|
-> TextIter |
|
-> m () |
Copies text, tags, and paintables between start
and end
and inserts the copy at iter
.
The order of start
and end
doesn’t matter.
Used instead of simply getting/inserting text because it preserves
images and tags. If start
and end
are in a different buffer from
buffer
, the two buffers must share the same tag table.
Implemented via emissions of the insertText and applyTag signals, so expect those.
insertRangeInteractive
textBufferInsertRangeInteractive Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> TextIter |
|
-> TextIter |
|
-> Bool |
|
-> m Bool | Returns: whether an insertion was possible at |
Copies text, tags, and paintables between start
and end
and inserts the copy at iter
.
Same as textBufferInsertRange
, but does nothing
if the insertion point isn’t editable. The defaultEditable
parameter indicates whether the text is editable at iter
if
no tags enclosing iter
affect editability. Typically the result
of textViewGetEditable
is appropriate here.
moveMark
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextMark b) | |
=> a |
|
-> b |
|
-> TextIter |
|
-> m () |
Moves mark
to the new location where
.
Emits the TextBuffer::markSet signal as notification of the move.
moveMarkByName
textBufferMoveMarkByName Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Text |
|
-> TextIter |
|
-> m () |
Moves the mark named name
(which must exist) to location where
.
See textBufferMoveMark
for details.
new
:: (HasCallStack, MonadIO m, IsTextTagTable a) | |
=> Maybe a |
|
-> m TextBuffer | Returns: a new text buffer |
Creates a new text buffer.
pasteClipboard
textBufferPasteClipboard Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsClipboard b) | |
=> a |
|
-> b |
|
-> Maybe TextIter |
|
-> Bool |
|
-> m () |
Pastes the contents of a clipboard.
If overrideLocation
is Nothing
, 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.
placeCursor
textBufferPlaceCursor Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> m () |
This function moves the “insert” and “selection_bound” marks simultaneously.
If you move them to the same place in two steps with
textBufferMoveMark
, 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.
redo
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m () |
Redoes the next redoable action on the buffer, if there is one.
removeAllTags
textBufferRemoveAllTags Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> TextIter |
|
-> m () |
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.
removeSelectionClipboard
textBufferRemoveSelectionClipboard Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsClipboard b) | |
=> a |
|
-> b |
|
-> m () |
Removes a GdkClipboard
added with
textBufferAddSelectionClipboard
.
removeTag
:: (HasCallStack, MonadIO m, IsTextBuffer a, IsTextTag b) | |
=> a |
|
-> b |
|
-> TextIter |
|
-> TextIter |
|
-> m () |
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.
removeTagByName
textBufferRemoveTagByName Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Text |
|
-> TextIter |
|
-> TextIter |
|
-> m () |
Emits the “remove-tag” signal.
Calls textTagTableLookup
on the buffer’s
tag table to get a GtkTextTag
, then calls
textBufferRemoveTag
.
selectRange
textBufferSelectRange Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> TextIter |
|
-> TextIter |
|
-> m () |
This function moves the “insert” and “selection_bound” marks simultaneously.
If you move them in two steps with
textBufferMoveMark
, 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.
setEnableUndo
textBufferSetEnableUndo Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether or not to enable undoable actions in the text buffer.
Undoable actions in this context are changes to the text content of the buffer. Changes to tags and marks are not tracked.
If enabled, the user will be able to undo the last number of actions
up to textBufferGetMaxUndoLevels
.
See textBufferBeginIrreversibleAction
and
textBufferEndIrreversibleAction
to create
changes to the buffer that cannot be undone.
setMaxUndoLevels
textBufferSetMaxUndoLevels Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Word32 |
|
-> m () |
Sets the maximum number of undo levels to perform.
If 0, unlimited undo actions may be performed. Note that this may have a memory usage impact as it requires storing an additional copy of the inserted or removed text within the text buffer.
setModified
textBufferSetModified Source #
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Bool |
|
-> m () |
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 (@buffer, 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::modifiedChanged signal.
setText
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> Text |
|
-> Int32 |
|
-> m () |
Deletes current contents of buffer
, and inserts text
instead. This is
automatically marked as an irreversible action in the undo stack. If you
wish to mark this action as part of a larger undo operation, call
[methodtextBuffer
.delete] and [methodtextBuffer
.insert] directly instead.
If len
is -1, text
must be nul-terminated.
text
must be valid UTF-8.
undo
:: (HasCallStack, MonadIO m, IsTextBuffer a) | |
=> a |
|
-> m () |
Undoes the last undoable action on the buffer, if there is one.
Properties
canRedo
Denotes that the buffer can reapply the last undone action.
getTextBufferCanRedo :: (MonadIO m, IsTextBuffer o) => o -> m Bool Source #
Get the value of the “can-redo
” property.
When overloading is enabled, this is equivalent to
get
textBuffer #canRedo
canUndo
Denotes that the buffer can undo the last applied action.
getTextBufferCanUndo :: (MonadIO m, IsTextBuffer o) => o -> m Bool Source #
Get the value of the “can-undo
” property.
When overloading is enabled, this is equivalent to
get
textBuffer #canUndo
cursorPosition
The position of the insert mark.
This is an offset from the beginning of the buffer. It is useful for getting notified when the cursor moves.
getTextBufferCursorPosition :: (MonadIO m, IsTextBuffer o) => o -> m Int32 Source #
Get the value of the “cursor-position
” property.
When overloading is enabled, this is equivalent to
get
textBuffer #cursorPosition
enableUndo
Denotes if support for undoing and redoing changes to the buffer is allowed.
constructTextBufferEnableUndo :: (IsTextBuffer o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “enable-undo
” property. This is rarely needed directly, but it is used by new
.
getTextBufferEnableUndo :: (MonadIO m, IsTextBuffer o) => o -> m Bool Source #
Get the value of the “enable-undo
” property.
When overloading is enabled, this is equivalent to
get
textBuffer #enableUndo
setTextBufferEnableUndo :: (MonadIO m, IsTextBuffer o) => o -> Bool -> m () Source #
Set the value of the “enable-undo
” property.
When overloading is enabled, this is equivalent to
set
textBuffer [ #enableUndo:=
value ]
hasSelection
Whether the buffer has some text currently selected.
getTextBufferHasSelection :: (MonadIO m, IsTextBuffer o) => o -> m Bool Source #
Get the value of the “has-selection
” property.
When overloading is enabled, this is equivalent to
get
textBuffer #hasSelection
tagTable
The GtkTextTagTable for the buffer.
constructTextBufferTagTable :: (IsTextBuffer o, MonadIO m, IsTextTagTable a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “tag-table
” property. This is rarely needed directly, but it is used by new
.
getTextBufferTagTable :: (MonadIO m, IsTextBuffer o) => o -> m TextTagTable Source #
Get the value of the “tag-table
” property.
When overloading is enabled, this is equivalent to
get
textBuffer #tagTable
text
The text content of the buffer.
Without child widgets and images,
see textBufferGetText
for more information.
clearTextBufferText :: (MonadIO m, IsTextBuffer o) => o -> m () Source #
Set the value of the “text
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#text
constructTextBufferText :: (IsTextBuffer o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “text
” property. This is rarely needed directly, but it is used by new
.
getTextBufferText :: (MonadIO m, IsTextBuffer o) => o -> m (Maybe Text) Source #
Get the value of the “text
” property.
When overloading is enabled, this is equivalent to
get
textBuffer #text
setTextBufferText :: (MonadIO m, IsTextBuffer o) => o -> Text -> m () Source #
Set the value of the “text
” property.
When overloading is enabled, this is equivalent to
set
textBuffer [ #text:=
value ]
Signals
applyTag
type TextBufferApplyTagCallback Source #
= TextTag |
|
-> TextIter |
|
-> TextIter |
|
-> IO () |
Emitted to apply a tag to a range of text in a GtkTextBuffer
.
Applying actually occurs in the default handler.
Note that if your handler runs before the default handler
it must not invalidate the start
and end
iters (or has to
revalidate them).
See also:
textBufferApplyTag
,
TextBuffer
.insert_with_tags
(),
textBufferInsertRange
.
afterTextBufferApplyTag :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferApplyTagCallback) -> m SignalHandlerId Source #
Connect a signal handler for the applyTag signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #applyTag callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferApplyTag :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferApplyTagCallback) -> m SignalHandlerId Source #
Connect a signal handler for the applyTag signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #applyTag callback
beginUserAction
type TextBufferBeginUserActionCallback = IO () Source #
Emitted at the beginning of a single user-visible
operation on a GtkTextBuffer
.
See also:
textBufferBeginUserAction
,
textBufferInsertInteractive
,
textBufferInsertRangeInteractive
,
textBufferDeleteInteractive
,
textBufferBackspace
,
textBufferDeleteSelection
.
afterTextBufferBeginUserAction :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferBeginUserActionCallback) -> m SignalHandlerId Source #
Connect a signal handler for the beginUserAction signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #beginUserAction callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferBeginUserAction :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferBeginUserActionCallback) -> m SignalHandlerId Source #
Connect a signal handler for the beginUserAction signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #beginUserAction callback
changed
type TextBufferChangedCallback = IO () Source #
Emitted when the content of a GtkTextBuffer
has changed.
afterTextBufferChanged :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #changed callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferChanged :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #changed callback
deleteRange
type TextBufferDeleteRangeCallback Source #
= TextIter |
|
-> TextIter |
|
-> IO () |
Emitted to delete a range from a GtkTextBuffer
.
Note that if your handler runs before the default handler
it must not invalidate the start
and end
iters (or has
to revalidate them). The default signal handler revalidates
the start
and end
iters to both point to the location
where text was deleted. Handlers which run after the default
handler (see g_signal_connect_after()
) do not have access to
the deleted text.
See also: textBufferDelete
.
afterTextBufferDeleteRange :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferDeleteRangeCallback) -> m SignalHandlerId Source #
Connect a signal handler for the deleteRange signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #deleteRange callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferDeleteRange :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferDeleteRangeCallback) -> m SignalHandlerId Source #
Connect a signal handler for the deleteRange signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #deleteRange callback
endUserAction
type TextBufferEndUserActionCallback = IO () Source #
Emitted at the end of a single user-visible
operation on the GtkTextBuffer
.
See also:
textBufferEndUserAction
,
textBufferInsertInteractive
,
textBufferInsertRangeInteractive
,
textBufferDeleteInteractive
,
textBufferBackspace
,
textBufferDeleteSelection
,
textBufferBackspace
.
afterTextBufferEndUserAction :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferEndUserActionCallback) -> m SignalHandlerId Source #
Connect a signal handler for the endUserAction signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #endUserAction callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferEndUserAction :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferEndUserActionCallback) -> m SignalHandlerId Source #
Connect a signal handler for the endUserAction signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #endUserAction callback
insertChildAnchor
type TextBufferInsertChildAnchorCallback Source #
= TextIter |
|
-> TextChildAnchor |
|
-> IO () |
Emitted to insert a GtkTextChildAnchor
in a GtkTextBuffer
.
Insertion actually occurs in the default handler.
Note that if your handler runs before the default handler
it must not invalidate the location
iter (or has to
revalidate it). The default signal handler revalidates
it to be placed after the inserted anchor
.
See also: textBufferInsertChildAnchor
.
afterTextBufferInsertChildAnchor :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferInsertChildAnchorCallback) -> m SignalHandlerId Source #
Connect a signal handler for the insertChildAnchor signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #insertChildAnchor callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferInsertChildAnchor :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferInsertChildAnchorCallback) -> m SignalHandlerId Source #
Connect a signal handler for the insertChildAnchor signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #insertChildAnchor callback
insertPaintable
type TextBufferInsertPaintableCallback Source #
= TextIter |
|
-> Paintable |
|
-> IO () |
Emitted to insert a GdkPaintable
in a GtkTextBuffer
.
Insertion actually occurs in the default handler.
Note that if your handler runs before the default handler
it must not invalidate the location
iter (or has to
revalidate it). The default signal handler revalidates
it to be placed after the inserted paintable
.
See also: textBufferInsertPaintable
.
afterTextBufferInsertPaintable :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferInsertPaintableCallback) -> m SignalHandlerId Source #
Connect a signal handler for the insertPaintable signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #insertPaintable callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferInsertPaintable :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferInsertPaintableCallback) -> m SignalHandlerId Source #
Connect a signal handler for the insertPaintable signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #insertPaintable callback
insertText
type TextBufferInsertTextCallback Source #
= TextIter |
|
-> Text |
|
-> Int32 |
|
-> IO () |
Emitted to insert text in a GtkTextBuffer
.
Insertion actually occurs in the default handler.
Note that if your handler runs before the default handler
it must not invalidate the location
iter (or has to
revalidate it). The default signal handler revalidates
it to point to the end of the inserted text.
See also: textBufferInsert
,
textBufferInsertRange
.
afterTextBufferInsertText :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferInsertTextCallback) -> m SignalHandlerId Source #
Connect a signal handler for the insertText signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #insertText callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferInsertText :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferInsertTextCallback) -> m SignalHandlerId Source #
Connect a signal handler for the insertText signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #insertText callback
markDeleted
type TextBufferMarkDeletedCallback Source #
Emitted as notification after a GtkTextMark
is deleted.
See also: textBufferDeleteMark
.
afterTextBufferMarkDeleted :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferMarkDeletedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the markDeleted signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #markDeleted callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferMarkDeleted :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferMarkDeletedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the markDeleted signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #markDeleted callback
markSet
type TextBufferMarkSetCallback Source #
Emitted as notification after a GtkTextMark
is set.
See also:
textBufferCreateMark
,
textBufferMoveMark
.
afterTextBufferMarkSet :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferMarkSetCallback) -> m SignalHandlerId Source #
Connect a signal handler for the markSet signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #markSet callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferMarkSet :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferMarkSetCallback) -> m SignalHandlerId Source #
Connect a signal handler for the markSet signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #markSet callback
modifiedChanged
type TextBufferModifiedChangedCallback = IO () Source #
Emitted when the modified bit of a GtkTextBuffer
flips.
See also: textBufferSetModified
.
afterTextBufferModifiedChanged :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferModifiedChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the modifiedChanged signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #modifiedChanged callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferModifiedChanged :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferModifiedChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the modifiedChanged signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #modifiedChanged callback
pasteDone
type TextBufferPasteDoneCallback Source #
= Clipboard |
|
-> IO () |
Emitted after paste operation has been completed.
This is useful to properly scroll the view to the end
of the pasted text. See textBufferPasteClipboard
for more details.
afterTextBufferPasteDone :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferPasteDoneCallback) -> m SignalHandlerId Source #
Connect a signal handler for the pasteDone signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #pasteDone callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferPasteDone :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferPasteDoneCallback) -> m SignalHandlerId Source #
Connect a signal handler for the pasteDone signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #pasteDone callback
redo
type TextBufferRedoCallback = IO () Source #
Emitted when a request has been made to redo the previously undone operation.
afterTextBufferRedo :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferRedoCallback) -> m SignalHandlerId Source #
Connect a signal handler for the redo signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #redo callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferRedo :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferRedoCallback) -> m SignalHandlerId Source #
Connect a signal handler for the redo signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #redo callback
removeTag
type TextBufferRemoveTagCallback Source #
= TextTag |
|
-> TextIter |
|
-> TextIter |
|
-> IO () |
Emitted to remove all occurrences of tag
from a range
of text in a GtkTextBuffer
.
Removal actually occurs in the default handler.
Note that if your handler runs before the default handler
it must not invalidate the start
and end
iters (or has
to revalidate them).
See also: textBufferRemoveTag
.
afterTextBufferRemoveTag :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferRemoveTagCallback) -> m SignalHandlerId Source #
Connect a signal handler for the removeTag signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #removeTag callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferRemoveTag :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferRemoveTagCallback) -> m SignalHandlerId Source #
Connect a signal handler for the removeTag signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #removeTag callback
undo
type TextBufferUndoCallback = IO () Source #
Emitted when a request has been made to undo the previous operation or set of operations that have been grouped together.
afterTextBufferUndo :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferUndoCallback) -> m SignalHandlerId Source #
Connect a signal handler for the undo signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
textBuffer #undo callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onTextBufferUndo :: (IsTextBuffer a, MonadIO m) => a -> ((?self :: a) => TextBufferUndoCallback) -> m SignalHandlerId Source #
Connect a signal handler for the undo signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
textBuffer #undo callback