rasa-0.1.12: A modular text editor

Safe HaskellNone
LanguageHaskell2010

Rasa.Internal.BufActions

Contents

Synopsis

Documentation

overRange :: CrdRange -> (YiString -> YiString) -> BufAction () Source #

Runs function over given range of text

replaceRange :: CrdRange -> YiString -> BufAction () Source #

Replaces the text in the given range with the given text.

deleteRange :: CrdRange -> BufAction () Source #

Deletes the text in the given range from the buffer.

insertAt :: Coord -> YiString -> BufAction () Source #

Inserts text into the buffer at the given Coord.

sizeOf :: YiString -> Coord Source #

Returns the number of rows and columns that a chunk of text spans as a Coord

getLineRange :: Row -> BufAction (Maybe CrdRange) Source #

Gets the range representing a given row (if that row exists)

Performing Apps on Buffers

bufDo :: BufRef -> BufAction a -> App (Maybe a) Source #

This lifts a BufAction to an App which performs the BufAction on the buffer referred to by the BufRef If the buffer referred to no longer exists this returns: Nothing.

buffersDo :: BufAction a -> App [a] Source #

This lifts a BufAction to an App which performs the BufAction on every buffer and collects the return values as a list.

Editor Apps

getBufRefs :: App [BufRef] Source #

Returns an up-to-date list of all BufRefs

nextBufRef :: BufRef -> App BufRef Source #

Gets BufRef that comes after the one provided

prevBufRef :: BufRef -> App BufRef Source #

Gets BufRef that comes before the one provided

getBufExt :: (Typeable s, Show s, Default s) => BufAction s Source #

Retrieve some buffer extension state

setBufExt :: (Typeable s, Show s, Default s) => s -> BufAction () Source #

Set some buffer extension state

overBufExt :: (Typeable s, Show s, Default s) => (s -> s) -> BufAction () Source #

Set some buffer extension state

getBufRef :: BufAction BufRef Source #

Gets the current buffer's BufRef

getRange :: CrdRange -> BufAction YiString Source #

Gets the range of text from the buffer

addBuffer :: YiString -> App BufRef Source #

Adds a new buffer and returns the BufRef

getBuffer :: BufRef -> App (Maybe Buffer) Source #

Retrieve a buffer. This is read-only for loggingrenderingdebugging purposes only.

dispatchBufEvent :: (Monoid result, Typeable eventType, Typeable result) => eventType -> BufAction result Source #

Dispatches an event of any type to the BufAction's buffer. See dispatchEvent

addBufListener :: (Typeable eventType, Typeable result, Monoid result) => (eventType -> BufAction result) -> BufAction ListenerId Source #

Adds a listener to the BufAction's buffer. See addListener

addBufListener_ :: (Typeable eventType, Typeable result, Monoid result) => (eventType -> BufAction result) -> BufAction () Source #

removeBufListener :: ListenerId -> BufAction () Source #

Removes a listener from the BufAction's buffer. See removeListener

onBufAdded :: (BufAdded -> App result) -> App ListenerId Source #

Registers an action to be performed after a new buffer is added.

The supplied function will be called with a BufRef to the new buffer, and the resulting App will be run.

onBufAdded_ :: (BufAdded -> App result) -> App () Source #

dispatchBufAdded :: BufAdded -> App () Source #

Dispatch the BufAdded action.

onEveryNewBuffer :: BufAction a -> App ListenerId Source #

Run the given BufAction over all new buffers

onBufTextChanged :: (BufTextChanged -> BufAction result) -> BufAction ListenerId Source #

This is fired every time text in a buffer changes.

The range of text which was altered and the new value of that text are provided inside a BufTextChanged event.

dispatchBufTextChanged :: BufTextChanged -> BufAction () Source #

Dispatch the BufBufTextChanged action.

getText :: BufAction YiString Source #

Returns the text of the current buffer