rasa-0.1.7: A modular text editor

Safe HaskellNone
LanguageHaskell2010

Rasa.Internal.Directive

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 Action 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 hook will run, then the editor will exit.

newBuffer :: YiString -> Action BufRef Source #

This adds a new buffer with the given text.

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 :: Range -> (YiString -> YiString) -> BufAction () Source #

Runs the given function over the text in the range, replacing it with the results.

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

Replaces the text in the given range from the buffer.

deleteRange :: Range -> 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