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 |
GI.GtkSource.Objects.Buffer
Contents
- Exported types
- Methods
- backwardIterToSourceMark
- changeCase
- createSourceMark
- ensureHighlight
- forwardIterToSourceMark
- getContextClassesAtIter
- getHighlightMatchingBrackets
- getHighlightSyntax
- getImplicitTrailingNewline
- getLanguage
- getLoading
- getSourceMarksAtIter
- getSourceMarksAtLine
- getStyleScheme
- iterBackwardToContextClassToggle
- iterForwardToContextClassToggle
- iterHasContextClass
- joinLines
- new
- newWithLanguage
- removeSourceMarks
- setHighlightMatchingBrackets
- setHighlightSyntax
- setImplicitTrailingNewline
- setLanguage
- setStyleScheme
- sortLines
- Properties
- Signals
Description
Subclass of TextBuffer
.
A GtkSourceBuffer
object is the model for [classview
] widgets.
It extends the TextBuffer
class by adding features useful to display
and edit source code such as syntax highlighting and bracket matching.
To create a GtkSourceBuffer
use bufferNew
or
bufferNewWithLanguage
. The second form is just a convenience
function which allows you to initially set a [classlanguage
]. You can also
directly create a [classview
] and get its [classbuffer
] with
textViewGetBuffer
.
The highlighting is enabled by default, but you can disable it with
[methodbuffer
.set_highlight_syntax].
Context Classes:
It is possible to retrieve some information from the syntax highlighting
engine. The default context classes that are applied to regions of a
GtkSourceBuffer
:
- **comment**: the region delimits a comment;
- **no-spell-check**: the region should not be spell checked;
- **path**: the region delimits a path to a file;
- **string**: the region delimits a string.
Custom language definition files can create their own context classes,
since the functions like [methodbuffer
.iter_has_context_class] take
a string parameter as the context class.
GtkSourceBuffer
provides an API to access the context classes:
[methodbuffer
.iter_has_context_class],
[methodbuffer
.get_context_classes_at_iter],
[methodbuffer
.iter_forward_to_context_class_toggle] and
[methodbuffer
.iter_backward_to_context_class_toggle].
And the Buffer::highlightUpdated signal permits to be notified when a context class region changes.
Each context class has also an associated TextTag
with the name
gtksourceview:context-classes:<name>
. For example to
retrieve the TextTag
for the string context class, one can write:
c code
GtkTextTagTable *tag_table; GtkTextTag *tag; tag_table = gtk_text_buffer_get_tag_table (buffer); tag = gtk_text_tag_table_lookup (tag_table, "gtksourceview:context-classes:string");
The tag must be used for read-only purposes.
Accessing a context class via the associated TextTag
is less
convenient than the GtkSourceBuffer
API, because:
- The tag doesn't always exist, you need to listen to the TextTagTable::tagAdded and TextTagTable::tagRemoved signals.
- Instead of the Buffer::highlightUpdated signal, you can listen to the TextBuffer::applyTag and TextBuffer::removeTag signals.
A possible use-case for accessing a context class via the associated
TextTag
is to read the region but without adding a hard dependency on the
GtkSourceView library (for example for a spell-checking library that wants to
read the no-spell-check region).
Synopsis
- newtype Buffer = Buffer (ManagedPtr Buffer)
- class (GObject o, IsDescendantOf Buffer o) => IsBuffer o
- toBuffer :: (MonadIO m, IsBuffer o) => o -> m Buffer
- bufferBackwardIterToSourceMark :: (HasCallStack, MonadIO m, IsBuffer a) => a -> TextIter -> Maybe Text -> m (Bool, TextIter)
- bufferChangeCase :: (HasCallStack, MonadIO m, IsBuffer a) => a -> ChangeCaseType -> TextIter -> TextIter -> m ()
- bufferCreateSourceMark :: (HasCallStack, MonadIO m, IsBuffer a) => a -> Maybe Text -> Text -> TextIter -> m Mark
- bufferEnsureHighlight :: (HasCallStack, MonadIO m, IsBuffer a) => a -> TextIter -> TextIter -> m ()
- bufferForwardIterToSourceMark :: (HasCallStack, MonadIO m, IsBuffer a) => a -> TextIter -> Maybe Text -> m (Bool, TextIter)
- bufferGetContextClassesAtIter :: (HasCallStack, MonadIO m, IsBuffer a) => a -> TextIter -> m [Text]
- bufferGetHighlightMatchingBrackets :: (HasCallStack, MonadIO m, IsBuffer a) => a -> m Bool
- bufferGetHighlightSyntax :: (HasCallStack, MonadIO m, IsBuffer a) => a -> m Bool
- bufferGetImplicitTrailingNewline :: (HasCallStack, MonadIO m, IsBuffer a) => a -> m Bool
- bufferGetLanguage :: (HasCallStack, MonadIO m, IsBuffer a) => a -> m (Maybe Language)
- bufferGetLoading :: (HasCallStack, MonadIO m, IsBuffer a) => a -> m Bool
- bufferGetSourceMarksAtIter :: (HasCallStack, MonadIO m, IsBuffer a) => a -> TextIter -> Maybe Text -> m [Mark]
- bufferGetSourceMarksAtLine :: (HasCallStack, MonadIO m, IsBuffer a) => a -> Int32 -> Maybe Text -> m [Mark]
- bufferGetStyleScheme :: (HasCallStack, MonadIO m, IsBuffer a) => a -> m (Maybe StyleScheme)
- bufferIterBackwardToContextClassToggle :: (HasCallStack, MonadIO m, IsBuffer a) => a -> TextIter -> Text -> m (Bool, TextIter)
- bufferIterForwardToContextClassToggle :: (HasCallStack, MonadIO m, IsBuffer a) => a -> TextIter -> Text -> m (Bool, TextIter)
- bufferIterHasContextClass :: (HasCallStack, MonadIO m, IsBuffer a) => a -> TextIter -> Text -> m Bool
- bufferJoinLines :: (HasCallStack, MonadIO m, IsBuffer a) => a -> TextIter -> TextIter -> m ()
- bufferNew :: (HasCallStack, MonadIO m, IsTextTagTable a) => Maybe a -> m Buffer
- bufferNewWithLanguage :: (HasCallStack, MonadIO m, IsLanguage a) => a -> m Buffer
- bufferRemoveSourceMarks :: (HasCallStack, MonadIO m, IsBuffer a) => a -> TextIter -> TextIter -> Maybe Text -> m ()
- bufferSetHighlightMatchingBrackets :: (HasCallStack, MonadIO m, IsBuffer a) => a -> Bool -> m ()
- bufferSetHighlightSyntax :: (HasCallStack, MonadIO m, IsBuffer a) => a -> Bool -> m ()
- bufferSetImplicitTrailingNewline :: (HasCallStack, MonadIO m, IsBuffer a) => a -> Bool -> m ()
- bufferSetLanguage :: (HasCallStack, MonadIO m, IsBuffer a, IsLanguage b) => a -> Maybe b -> m ()
- bufferSetStyleScheme :: (HasCallStack, MonadIO m, IsBuffer a, IsStyleScheme b) => a -> Maybe b -> m ()
- bufferSortLines :: (HasCallStack, MonadIO m, IsBuffer a) => a -> TextIter -> TextIter -> [SortFlags] -> Int32 -> m ()
- constructBufferHighlightMatchingBrackets :: (IsBuffer o, MonadIO m) => Bool -> m (GValueConstruct o)
- getBufferHighlightMatchingBrackets :: (MonadIO m, IsBuffer o) => o -> m Bool
- setBufferHighlightMatchingBrackets :: (MonadIO m, IsBuffer o) => o -> Bool -> m ()
- constructBufferHighlightSyntax :: (IsBuffer o, MonadIO m) => Bool -> m (GValueConstruct o)
- getBufferHighlightSyntax :: (MonadIO m, IsBuffer o) => o -> m Bool
- setBufferHighlightSyntax :: (MonadIO m, IsBuffer o) => o -> Bool -> m ()
- constructBufferImplicitTrailingNewline :: (IsBuffer o, MonadIO m) => Bool -> m (GValueConstruct o)
- getBufferImplicitTrailingNewline :: (MonadIO m, IsBuffer o) => o -> m Bool
- setBufferImplicitTrailingNewline :: (MonadIO m, IsBuffer o) => o -> Bool -> m ()
- clearBufferLanguage :: (MonadIO m, IsBuffer o) => o -> m ()
- constructBufferLanguage :: (IsBuffer o, MonadIO m, IsLanguage a) => a -> m (GValueConstruct o)
- getBufferLanguage :: (MonadIO m, IsBuffer o) => o -> m (Maybe Language)
- setBufferLanguage :: (MonadIO m, IsBuffer o, IsLanguage a) => o -> a -> m ()
- getBufferLoading :: (MonadIO m, IsBuffer o) => o -> m Bool
- clearBufferStyleScheme :: (MonadIO m, IsBuffer o) => o -> m ()
- constructBufferStyleScheme :: (IsBuffer o, MonadIO m, IsStyleScheme a) => a -> m (GValueConstruct o)
- getBufferStyleScheme :: (MonadIO m, IsBuffer o) => o -> m (Maybe StyleScheme)
- setBufferStyleScheme :: (MonadIO m, IsBuffer o, IsStyleScheme a) => o -> a -> m ()
- type BufferBracketMatchedCallback = Maybe TextIter -> BracketMatchType -> IO ()
- afterBufferBracketMatched :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferBracketMatchedCallback) -> m SignalHandlerId
- onBufferBracketMatched :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferBracketMatchedCallback) -> m SignalHandlerId
- type BufferCursorMovedCallback = IO ()
- afterBufferCursorMoved :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferCursorMovedCallback) -> m SignalHandlerId
- onBufferCursorMoved :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferCursorMovedCallback) -> m SignalHandlerId
- type BufferHighlightUpdatedCallback = TextIter -> TextIter -> IO ()
- afterBufferHighlightUpdated :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferHighlightUpdatedCallback) -> m SignalHandlerId
- onBufferHighlightUpdated :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferHighlightUpdatedCallback) -> m SignalHandlerId
- type BufferSourceMarkUpdatedCallback = TextMark -> IO ()
- afterBufferSourceMarkUpdated :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferSourceMarkUpdatedCallback) -> m SignalHandlerId
- onBufferSourceMarkUpdated :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferSourceMarkUpdatedCallback) -> m SignalHandlerId
Exported types
Memory-managed wrapper type.
Instances
Eq Buffer Source # | |
GObject Buffer Source # | |
Defined in GI.GtkSource.Objects.Buffer | |
ManagedPtrNewtype Buffer Source # | |
Defined in GI.GtkSource.Objects.Buffer Methods toManagedPtr :: Buffer -> ManagedPtr Buffer | |
TypedObject Buffer Source # | |
Defined in GI.GtkSource.Objects.Buffer | |
HasParentTypes Buffer Source # | |
Defined in GI.GtkSource.Objects.Buffer | |
IsGValue (Maybe Buffer) Source # | Convert |
Defined in GI.GtkSource.Objects.Buffer Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Buffer -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Buffer) | |
type ParentTypes Buffer Source # | |
Defined in GI.GtkSource.Objects.Buffer type ParentTypes Buffer = '[TextBuffer, Object] |
class (GObject o, IsDescendantOf Buffer o) => IsBuffer o Source #
Instances
(GObject o, IsDescendantOf Buffer o) => IsBuffer o Source # | |
Defined in GI.GtkSource.Objects.Buffer |
Methods
Click to display all available methods, including inherited ones
Methods
addMark, addSelectionClipboard, applyTag, applyTagByName, backspace, backwardIterToSourceMark, beginIrreversibleAction, beginUserAction, bindProperty, bindPropertyFull, changeCase, copyClipboard, createChildAnchor, createMark, createSourceMark, cutClipboard, delete, deleteInteractive, deleteMark, deleteMarkByName, deleteSelection, endIrreversibleAction, endUserAction, ensureHighlight, forceFloating, forwardIterToSourceMark, freezeNotify, getv, insert, insertAtCursor, insertChildAnchor, insertInteractive, insertInteractiveAtCursor, insertMarkup, insertPaintable, insertRange, insertRangeInteractive, isFloating, iterBackwardToContextClassToggle, iterForwardToContextClassToggle, iterHasContextClass, joinLines, moveMark, moveMarkByName, notify, notifyByPspec, pasteClipboard, placeCursor, redo, ref, refSink, removeAllTags, removeSelectionClipboard, removeSourceMarks, removeTag, removeTagByName, runDispose, selectRange, sortLines, stealData, stealQdata, thawNotify, undo, unref, watchClosure.
Getters
getBounds, getCanRedo, getCanUndo, getCharCount, getContextClassesAtIter, getData, getEnableUndo, getEndIter, getHasSelection, getHighlightMatchingBrackets, getHighlightSyntax, getImplicitTrailingNewline, getInsert, getIterAtChildAnchor, getIterAtLine, getIterAtLineIndex, getIterAtLineOffset, getIterAtMark, getIterAtOffset, getLanguage, getLineCount, getLoading, getMark, getMaxUndoLevels, getModified, getProperty, getQdata, getSelectionBound, getSelectionBounds, getSelectionContent, getSlice, getSourceMarksAtIter, getSourceMarksAtLine, getStartIter, getStyleScheme, getTagTable, getText.
Setters
setData, setDataFull, setEnableUndo, setHighlightMatchingBrackets, setHighlightSyntax, setImplicitTrailingNewline, setLanguage, setMaxUndoLevels, setModified, setProperty, setStyleScheme, setText.
backwardIterToSourceMark
bufferBackwardIterToSourceMark Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> TextIter |
|
-> Maybe Text |
|
-> m (Bool, TextIter) | Returns: whether |
Moves iter
to the position of the previous [classmark
] of the given
category.
Returns True
if iter
was moved. If category
is NULL, the
previous source mark can be of any category.
changeCase
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> ChangeCaseType |
|
-> TextIter |
|
-> TextIter |
|
-> m () |
Changes the case of the text between the specified iterators.
Since 5.4, this function will update the position of start
and
end
to surround the modified text.
createSourceMark
bufferCreateSourceMark Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> Maybe Text |
|
-> Text |
|
-> TextIter |
|
-> m Mark | Returns: a new [class |
Creates a source mark in the buffer
of category category
.
A source mark is a TextMark
but organized into categories.
Depending on the category a pixbuf can be specified that will be displayed
along the line of the mark.
Like a TextMark
, a [classmark
] can be anonymous if the
passed name
is Nothing
. Also, the buffer owns the marks so you
shouldn't unreference it.
Marks always have left gravity and are moved to the beginning of the line when the user deletes the line they were in.
Typical uses for a source mark are bookmarks, breakpoints, current executing instruction indication in a source file, etc..
ensureHighlight
bufferEnsureHighlight Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> TextIter |
|
-> TextIter |
|
-> m () |
Forces buffer to analyze and highlight the given area synchronously.
- *Note**:
This is a potentially slow operation and should be used only when you need to make sure that some text not currently visible is highlighted, for instance before printing.
forwardIterToSourceMark
bufferForwardIterToSourceMark Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> TextIter |
|
-> Maybe Text |
|
-> m (Bool, TextIter) | Returns: whether |
Moves iter
to the position of the next [classmark
] of the given
category
.
Returns True
if iter
was moved. If category
is NULL, the
next source mark can be of any category.
getContextClassesAtIter
bufferGetContextClassesAtIter Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> TextIter |
|
-> m [Text] | Returns: a new |
Get all defined context classes at iter
.
See the [classbuffer
] description for the list of default context classes.
getHighlightMatchingBrackets
bufferGetHighlightMatchingBrackets Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> m Bool | Returns: |
Determines whether bracket match highlighting is activated for the source buffer.
getHighlightSyntax
bufferGetHighlightSyntax Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> m Bool | Returns: |
Determines whether syntax highlighting is activated in the source buffer.
getImplicitTrailingNewline
bufferGetImplicitTrailingNewline Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> m Bool | Returns: whether the |
No description available in the introspection data.
getLanguage
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> m (Maybe Language) | Returns: the [class |
Returns the [classlanguage
] associated with the buffer,
see [methodbuffer
.set_language].
The returned object should not be unreferenced by the user.
getLoading
bufferGetLoading :: (HasCallStack, MonadIO m, IsBuffer a) => a -> m Bool Source #
No description available in the introspection data.
getSourceMarksAtIter
bufferGetSourceMarksAtIter Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> TextIter |
|
-> Maybe Text |
|
-> m [Mark] | Returns:
a newly allocated |
Returns the list of marks of the given category at iter
.
If category
is Nothing
it returns all marks at iter
.
getSourceMarksAtLine
bufferGetSourceMarksAtLine Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> Int32 |
|
-> Maybe Text |
|
-> m [Mark] | Returns:
a newly allocated |
Returns the list of marks of the given category at line
.
If category
is Nothing
, all marks at line
are returned.
getStyleScheme
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> m (Maybe StyleScheme) | Returns: the [class |
Returns the [classstyleScheme
] associated with the buffer,
see [methodbuffer
.set_style_scheme].
The returned object should not be unreferenced by the user.
iterBackwardToContextClassToggle
bufferIterBackwardToContextClassToggle Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> TextIter |
|
-> Text |
|
-> m (Bool, TextIter) | Returns: whether we found a context class toggle before |
Moves backward to the next toggle (on or off) of the context class.
If no matching context class toggles are found, returns False
, otherwise True
.
Does not return toggles located at iter
, only toggles after iter
. Sets
iter
to the location of the toggle, or to the end of the buffer if no
toggle is found.
See the [classbuffer
] description for the list of default context classes.
iterForwardToContextClassToggle
bufferIterForwardToContextClassToggle Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> TextIter |
|
-> Text |
|
-> m (Bool, TextIter) | Returns: whether we found a context class toggle after |
Moves forward to the next toggle (on or off) of the context class.
If no matching context class toggles are found, returns False
, otherwise True
.
Does not return toggles located at iter
, only toggles after iter
. Sets
iter
to the location of the toggle, or to the end of the buffer if no
toggle is found.
See the [classbuffer
] description for the list of default context classes.
iterHasContextClass
bufferIterHasContextClass Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> TextIter |
|
-> Text |
|
-> m Bool | Returns: whether |
Check if the class contextClass
is set on iter
.
See the [classbuffer
] description for the list of default context classes.
joinLines
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> TextIter |
|
-> TextIter |
|
-> m () |
Joins the lines of text between the specified iterators.
new
Arguments
:: (HasCallStack, MonadIO m, IsTextTagTable a) | |
=> Maybe a |
|
-> m Buffer | Returns: a new source buffer. |
Creates a new source buffer.
newWithLanguage
bufferNewWithLanguage Source #
Arguments
:: (HasCallStack, MonadIO m, IsLanguage a) | |
=> a |
|
-> m Buffer | Returns: a new source buffer which will highlight text
according to the highlighting patterns in |
Creates a new source buffer using the highlighting patterns in language
.
This is equivalent to creating a new source buffer with
a new tag table and then calling [methodbuffer
.set_language].
removeSourceMarks
bufferRemoveSourceMarks Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> TextIter |
|
-> TextIter |
|
-> Maybe Text |
|
-> m () |
Remove all marks of category
between start
and end
from the buffer.
If category
is NULL, all marks in the range will be removed.
setHighlightMatchingBrackets
bufferSetHighlightMatchingBrackets Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> Bool |
|
-> m () |
Controls the bracket match highlighting function in the buffer.
If activated, when you position your cursor over a bracket character (a parenthesis, a square bracket, etc.) the matching opening or closing bracket character will be highlighted.
setHighlightSyntax
bufferSetHighlightSyntax Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> Bool |
|
-> m () |
Controls whether syntax is highlighted in the buffer.
If highlight
is True
, the text will be highlighted according to the syntax
patterns specified in the [classlanguage
] set with [methodbuffer
.set_language].
If highlight
is False
, syntax highlighting is disabled and all the
TextTag
objects that have been added by the syntax highlighting engine
are removed from the buffer.
setImplicitTrailingNewline
bufferSetImplicitTrailingNewline Source #
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether the buffer
has an implicit trailing newline.
If an explicit trailing newline is present in a TextBuffer
, TextView
shows it as an empty line. This is generally not what the user expects.
If implicitTrailingNewline
is True
(the default value):
- when a [classfileLoader
] loads the content of a file into the buffer
,
the trailing newline (if present in the file) is not inserted into the
buffer
.
- when a [classfileSaver
] saves the content of the buffer
into a file, a
trailing newline is added to the file.
On the other hand, if implicitTrailingNewline
is False
, the file's
content is not modified when loaded into the buffer
, and the buffer
's
content is not modified when saved into a file.
setLanguage
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a, IsLanguage b) | |
=> a |
|
-> Maybe b | |
-> m () |
Associates a [classlanguage
] with the buffer.
Note that a [classlanguage
] affects not only the syntax highlighting, but
also the context classes. If you want to disable just the
syntax highlighting, see [methodbuffer
.set_highlight_syntax].
The buffer holds a reference to language
.
setStyleScheme
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a, IsStyleScheme b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets a [classstyleScheme
] to be used by the buffer and the view.
Note that a [classstyleScheme
] affects not only the syntax highlighting,
but also other [classview
] features such as highlighting the current line,
matching brackets, the line numbers, etc.
Instead of setting a Nothing
scheme
, it is better to disable syntax
highlighting with [methodbuffer
.set_highlight_syntax], and setting the
[classstyleScheme
] with the "classic" or "tango" ID, because those two
style schemes follow more closely the GTK theme (for example for the
background color).
The buffer holds a reference to scheme
.
sortLines
Arguments
:: (HasCallStack, MonadIO m, IsBuffer a) | |
=> a |
|
-> TextIter |
|
-> TextIter |
|
-> [SortFlags] |
|
-> Int32 |
|
-> m () |
Sort the lines of text between the specified iterators.
Properties
highlightMatchingBrackets
Whether to highlight matching brackets in the buffer.
constructBufferHighlightMatchingBrackets :: (IsBuffer o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “highlight-matching-brackets
” property. This is rarely needed directly, but it is used by new
.
getBufferHighlightMatchingBrackets :: (MonadIO m, IsBuffer o) => o -> m Bool Source #
Get the value of the “highlight-matching-brackets
” property.
When overloading is enabled, this is equivalent to
get
buffer #highlightMatchingBrackets
setBufferHighlightMatchingBrackets :: (MonadIO m, IsBuffer o) => o -> Bool -> m () Source #
Set the value of the “highlight-matching-brackets
” property.
When overloading is enabled, this is equivalent to
set
buffer [ #highlightMatchingBrackets:=
value ]
highlightSyntax
Whether to highlight syntax in the buffer.
constructBufferHighlightSyntax :: (IsBuffer o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “highlight-syntax
” property. This is rarely needed directly, but it is used by new
.
getBufferHighlightSyntax :: (MonadIO m, IsBuffer o) => o -> m Bool Source #
Get the value of the “highlight-syntax
” property.
When overloading is enabled, this is equivalent to
get
buffer #highlightSyntax
setBufferHighlightSyntax :: (MonadIO m, IsBuffer o) => o -> Bool -> m () Source #
Set the value of the “highlight-syntax
” property.
When overloading is enabled, this is equivalent to
set
buffer [ #highlightSyntax:=
value ]
implicitTrailingNewline
Whether the buffer has an implicit trailing newline. See
[methodbuffer
.set_implicit_trailing_newline].
constructBufferImplicitTrailingNewline :: (IsBuffer o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “implicit-trailing-newline
” property. This is rarely needed directly, but it is used by new
.
getBufferImplicitTrailingNewline :: (MonadIO m, IsBuffer o) => o -> m Bool Source #
Get the value of the “implicit-trailing-newline
” property.
When overloading is enabled, this is equivalent to
get
buffer #implicitTrailingNewline
setBufferImplicitTrailingNewline :: (MonadIO m, IsBuffer o) => o -> Bool -> m () Source #
Set the value of the “implicit-trailing-newline
” property.
When overloading is enabled, this is equivalent to
set
buffer [ #implicitTrailingNewline:=
value ]
language
No description available in the introspection data.
clearBufferLanguage :: (MonadIO m, IsBuffer o) => o -> m () Source #
Set the value of the “language
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#language
constructBufferLanguage :: (IsBuffer o, MonadIO m, IsLanguage a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “language
” property. This is rarely needed directly, but it is used by new
.
getBufferLanguage :: (MonadIO m, IsBuffer o) => o -> m (Maybe Language) Source #
Get the value of the “language
” property.
When overloading is enabled, this is equivalent to
get
buffer #language
setBufferLanguage :: (MonadIO m, IsBuffer o, IsLanguage a) => o -> a -> m () Source #
Set the value of the “language
” property.
When overloading is enabled, this is equivalent to
set
buffer [ #language:=
value ]
loading
The "loading" property denotes that a GtkSourceFileLoader
is
currently loading the buffer.
Applications may want to use this setting to avoid doing work while the buffer is loading such as spellchecking.
Since: 5.10
getBufferLoading :: (MonadIO m, IsBuffer o) => o -> m Bool Source #
Get the value of the “loading
” property.
When overloading is enabled, this is equivalent to
get
buffer #loading
styleScheme
Style scheme. It contains styles for syntax highlighting, optionally foreground, background, cursor color, current line color, and matching brackets style.
clearBufferStyleScheme :: (MonadIO m, IsBuffer o) => o -> m () Source #
Set the value of the “style-scheme
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#styleScheme
constructBufferStyleScheme :: (IsBuffer o, MonadIO m, IsStyleScheme a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “style-scheme
” property. This is rarely needed directly, but it is used by new
.
getBufferStyleScheme :: (MonadIO m, IsBuffer o) => o -> m (Maybe StyleScheme) Source #
Get the value of the “style-scheme
” property.
When overloading is enabled, this is equivalent to
get
buffer #styleScheme
setBufferStyleScheme :: (MonadIO m, IsBuffer o, IsStyleScheme a) => o -> a -> m () Source #
Set the value of the “style-scheme
” property.
When overloading is enabled, this is equivalent to
set
buffer [ #styleScheme:=
value ]
Signals
bracketMatched
type BufferBracketMatchedCallback Source #
Arguments
= Maybe TextIter |
|
-> BracketMatchType |
|
-> IO () |
iter
is set to a valid iterator pointing to the matching bracket
if state
is BracketMatchTypeFound
. Otherwise iter
is
meaningless.
The signal is emitted only when the state
changes, typically when
the cursor moves.
A use-case for this signal is to show messages in a Statusbar
.
afterBufferBracketMatched :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferBracketMatchedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the bracketMatched signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
buffer #bracketMatched 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.
onBufferBracketMatched :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferBracketMatchedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the bracketMatched signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
buffer #bracketMatched callback
cursorMoved
type BufferCursorMovedCallback = IO () Source #
The "cursor-moved" signal is emitted when then insertion mark has moved.
afterBufferCursorMoved :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferCursorMovedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the cursorMoved signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
buffer #cursorMoved 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.
onBufferCursorMoved :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferCursorMovedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the cursorMoved signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
buffer #cursorMoved callback
highlightUpdated
type BufferHighlightUpdatedCallback Source #
Arguments
= TextIter |
|
-> TextIter |
|
-> IO () |
The highlightUpdated signal is emitted when the syntax
highlighting and context classes are updated in a
certain region of the buffer
.
afterBufferHighlightUpdated :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferHighlightUpdatedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the highlightUpdated signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
buffer #highlightUpdated 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.
onBufferHighlightUpdated :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferHighlightUpdatedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the highlightUpdated signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
buffer #highlightUpdated callback
sourceMarkUpdated
type BufferSourceMarkUpdatedCallback Source #
Arguments
= TextMark |
|
-> IO () |
The sourceMarkUpdated signal is emitted each time
a mark is added to, moved or removed from the buffer
.
afterBufferSourceMarkUpdated :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferSourceMarkUpdatedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the sourceMarkUpdated signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
buffer #sourceMarkUpdated 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.
onBufferSourceMarkUpdated :: (IsBuffer a, MonadIO m) => a -> ((?self :: a) => BufferSourceMarkUpdatedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the sourceMarkUpdated signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
buffer #sourceMarkUpdated callback