rasa-0.1.0.0: A modular text editor

Safe HaskellNone
LanguageHaskell2010

Rasa.Internal.Editor

Contents

Synopsis

Accessing/Storing state

data Editor Source #

This is the primary state of the editor.

Instances

focused is the index of the currently selected buffer (this will likely change)

buffers is a lens into all buffers.

exiting Whether the editor is in the process of exiting. Can be set inside an Action:

exiting .= True

ext :: forall a. (Show a, Typeable a, Default a) => Lens' Editor a Source #

ext is a lens which will focus the extension state that matches the type inferred as the focal point. It's a little bit of magic, if you treat the focus as a member of your extension state it should just work out.

This lens falls back on the extension's Default instance (when getting) if nothing has yet been stored.

allBufExt :: forall a. (Show a, Typeable a) => Traversal' Editor (Maybe a) Source #

A lens over the extensions of all buffers. This is useful for setting defaults or altering extension state across all buffers.

bufExt :: forall a. (Show a, Typeable a, Default a) => Lens' Buffer a Source #

bufExt is a lens which will focus a given extension's state within a buffer (within a BufAction). The lens will automagically focus the required extension by using type inference. It's a little bit of magic, if you treat the focus as a member of your extension state it should just work out.

This lens falls back on the extension's Default instance (when getting) if nothing has yet been stored.

focusedBuf :: Lens' Editor Buffer Source #

focusedBuf is a lens which focuses the currently selected buffer.

range :: Range -> Lens' Buffer YiString Source #

A lens over text which is encompassed by a Range