Copyright | (c) Eric Mertens 2016 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
This module provides support for the text operations important for providing a text input in the IRC client. It tracks user input history, tab completion history, and provides many update operations which are mapped to the keyboard in Client.EventLoop.
Synopsis
- data EditBox
- defaultEditBox :: EditBox
- content :: Lens' EditBox Content
- lastOperation :: Lens' EditBox LastOperation
- data Line = Line !Int !String
- singleLine :: Line -> Content
- endLine :: String -> Line
- class HasLine c where
- data Content
- shift :: Content -> (String, Content)
- above :: Lens' Content [String]
- below :: Lens' Content [String]
- delete :: Content -> Content
- backspace :: Content -> Content
- home :: EditBox -> EditBox
- end :: EditBox -> EditBox
- killHome :: EditBox -> EditBox
- killEnd :: EditBox -> EditBox
- killWordBackward :: (Char -> Bool) -> Bool -> EditBox -> EditBox
- killWordForward :: (Char -> Bool) -> Bool -> EditBox -> EditBox
- yank :: EditBox -> EditBox
- toggle :: Content -> Content
- left :: Content -> Content
- right :: Content -> Content
- leftWord :: Content -> Content
- rightWord :: Content -> Content
- insert :: Char -> EditBox -> EditBox
- insertPaste :: String -> EditBox -> EditBox
- insertString :: String -> Content -> Content
- earlier :: EditBox -> Maybe EditBox
- later :: EditBox -> Maybe EditBox
- success :: EditBox -> EditBox
- insertDigraph :: Map Digraph Text -> EditBox -> Maybe EditBox
- data LastOperation
Edit box type
defaultEditBox :: EditBox Source #
Default EditBox
value
Line type
Content type
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.
Operations
killHome :: EditBox -> EditBox Source #
Delete all text from the cursor to the beginning and store it in the yank buffer.
killEnd :: EditBox -> EditBox Source #
Delete all text from the cursor to the end and store it in the yank buffer.
Kill the content from the cursor back to the previous word boundary.
When yank
is set the yank buffer will be updated.
Kill the content from the curser forward to the next word boundary.
When yank
is set the yank buffer will be updated
insert :: Char -> EditBox -> EditBox Source #
Insert a character at the cursor and advance the cursor.
insertString :: String -> Content -> Content Source #
Insert string at cursor, cursor is advanced to the end of the inserted string.
earlier :: EditBox -> Maybe EditBox Source #
Update the editbox to reflect the earlier element in the history.
later :: EditBox -> Maybe EditBox Source #
Update the editbox to reflect the later element in the history.
success :: EditBox -> EditBox Source #
Indicate that the contents of the text box were successfully used by the program. This clears the first line of the contents and updates the history.
Last operation
data LastOperation Source #
Instances
Read LastOperation Source # | |
Defined in Client.State.EditBox readsPrec :: Int -> ReadS LastOperation # readList :: ReadS [LastOperation] # | |
Show LastOperation Source # | |
Defined in Client.State.EditBox showsPrec :: Int -> LastOperation -> ShowS # show :: LastOperation -> String # showList :: [LastOperation] -> ShowS # |