module NanoUI.Widgets.TextCommand
( TextCommand (..)
, TextMotion (..)
) where
import Data.Text (Text)
import NanoUI.Widgets.TextBuffer (Cursor)
data TextMotion
= CharLeft
| CharRight
| WordLeft
| WordRight
| LineStart
| LineEnd
| LineUp
| LineDown
| DocumentStart
| DocumentEnd
deriving (TextMotion -> TextMotion -> Bool
(TextMotion -> TextMotion -> Bool)
-> (TextMotion -> TextMotion -> Bool) -> Eq TextMotion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TextMotion -> TextMotion -> Bool
== :: TextMotion -> TextMotion -> Bool
$c/= :: TextMotion -> TextMotion -> Bool
/= :: TextMotion -> TextMotion -> Bool
Eq, Int -> TextMotion -> ShowS
[TextMotion] -> ShowS
TextMotion -> String
(Int -> TextMotion -> ShowS)
-> (TextMotion -> String)
-> ([TextMotion] -> ShowS)
-> Show TextMotion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TextMotion -> ShowS
showsPrec :: Int -> TextMotion -> ShowS
$cshow :: TextMotion -> String
show :: TextMotion -> String
$cshowList :: [TextMotion] -> ShowS
showList :: [TextMotion] -> ShowS
Show, Int -> TextMotion
TextMotion -> Int
TextMotion -> [TextMotion]
TextMotion -> TextMotion
TextMotion -> TextMotion -> [TextMotion]
TextMotion -> TextMotion -> TextMotion -> [TextMotion]
(TextMotion -> TextMotion)
-> (TextMotion -> TextMotion)
-> (Int -> TextMotion)
-> (TextMotion -> Int)
-> (TextMotion -> [TextMotion])
-> (TextMotion -> TextMotion -> [TextMotion])
-> (TextMotion -> TextMotion -> [TextMotion])
-> (TextMotion -> TextMotion -> TextMotion -> [TextMotion])
-> Enum TextMotion
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: TextMotion -> TextMotion
succ :: TextMotion -> TextMotion
$cpred :: TextMotion -> TextMotion
pred :: TextMotion -> TextMotion
$ctoEnum :: Int -> TextMotion
toEnum :: Int -> TextMotion
$cfromEnum :: TextMotion -> Int
fromEnum :: TextMotion -> Int
$cenumFrom :: TextMotion -> [TextMotion]
enumFrom :: TextMotion -> [TextMotion]
$cenumFromThen :: TextMotion -> TextMotion -> [TextMotion]
enumFromThen :: TextMotion -> TextMotion -> [TextMotion]
$cenumFromTo :: TextMotion -> TextMotion -> [TextMotion]
enumFromTo :: TextMotion -> TextMotion -> [TextMotion]
$cenumFromThenTo :: TextMotion -> TextMotion -> TextMotion -> [TextMotion]
enumFromThenTo :: TextMotion -> TextMotion -> TextMotion -> [TextMotion]
Enum, TextMotion
TextMotion -> TextMotion -> Bounded TextMotion
forall a. a -> a -> Bounded a
$cminBound :: TextMotion
minBound :: TextMotion
$cmaxBound :: TextMotion
maxBound :: TextMotion
Bounded)
data TextCommand
=
InsertText !Text
|
Delete !TextMotion
|
Move !TextMotion !Bool
| SelectAll
|
Select !Cursor !Cursor
|
Replace !Cursor !Cursor !Text
|
ReplaceAll !Text
| Undo
| Redo
| Cut
| Copy
| Paste
deriving (TextCommand -> TextCommand -> Bool
(TextCommand -> TextCommand -> Bool)
-> (TextCommand -> TextCommand -> Bool) -> Eq TextCommand
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TextCommand -> TextCommand -> Bool
== :: TextCommand -> TextCommand -> Bool
$c/= :: TextCommand -> TextCommand -> Bool
/= :: TextCommand -> TextCommand -> Bool
Eq, Int -> TextCommand -> ShowS
[TextCommand] -> ShowS
TextCommand -> String
(Int -> TextCommand -> ShowS)
-> (TextCommand -> String)
-> ([TextCommand] -> ShowS)
-> Show TextCommand
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TextCommand -> ShowS
showsPrec :: Int -> TextCommand -> ShowS
$cshow :: TextCommand -> String
show :: TextCommand -> String
$cshowList :: [TextCommand] -> ShowS
showList :: [TextCommand] -> ShowS
Show)