rasa-0.1.9: A modular text editor

Safe HaskellNone
LanguageHaskell2010

Rasa.Internal.Actions

Contents

Synopsis

Performing Actions on Buffers

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

This lifts a BufAction to an Action 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 -> Action [a] Source #

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

Editor Actions

exit :: Action () Source #

This signals to the editor that you'd like to shutdown. The current events will finish processing, then the onExit event will be dispatched, then the editor will exit.

newBuffer :: YiString -> Action BufRef Source #

This adds a new buffer with the given text, returning a reference to that buffer.

getBufRefs :: Action [BufRef] Source #

Returns an up-to-date list of all BufRefs

getBuffers :: Action [(BufRef, Buffer)] Source #

Returns an up-to-date list of all Buffers, returned values are read-only; altering them has no effect on the actual stored buffers. This function is useful for renderers.

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

Returns the Buffer for a BufRef if it still exists. This is read-only; altering the buffer has no effect on the stored buffer. This function is useful for renderers.

nextBufRef :: BufRef -> Action BufRef Source #

Gets BufRef that comes after the one provided

prevBufRef :: BufRef -> Action BufRef Source #

Gets BufRef that comes before the one provided

Buffer Actions

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