Copyright | (c) Eric Mertens 2016 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
This module manages simple text navigation and manipulation, but leaves more complicated operations like yank/kill and history management to Client.State.EditBox
Synopsis
- data Content
- above :: Lens' Content [String]
- below :: Lens' Content [String]
- singleLine :: Line -> Content
- noContent :: Content
- shift :: Content -> (String, Content)
- toStrings :: Content -> NonEmpty String
- fromStrings :: NonEmpty String -> Content
- data Line = Line {}
- class HasLine c where
- endLine :: String -> Line
- left :: Content -> Content
- right :: Content -> Content
- leftWord :: Content -> Content
- rightWord :: Content -> Content
- jumpLeft :: Content -> Content
- jumpRight :: Content -> Content
- delete :: Content -> Content
- backspace :: Content -> Content
- insertPastedString :: String -> Content -> Content
- insertString :: String -> Content -> Content
- insertChar :: Char -> Content -> Content
- toggle :: Content -> Content
- digraph :: Map Digraph Text -> Content -> Maybe Content
Multiple lines
Zipper-ish view of the multi-line content of an EditBox
.
Lines above
the currentLine
are stored in reverse order.
shift :: Content -> (String, Content) Source #
Shifts the first line off of the Content
, yielding the
text of the line and the rest of the content.
Focused line
Movements
jumpLeft :: Content -> Content Source #
When at beginning of line, jump to beginning of previous line. Otherwise jump to beginning of current line.
jumpRight :: Content -> Content Source #
When at end of line, jump to end of next line. Otherwise jump to end of current line.
Edits
insertPastedString :: String -> Content -> Content Source #
Smarter version of insertString
that removes spurious newlines.