text-region-0.3.0.0: Marking text regions

Safe HaskellNone
LanguageHaskell2010

Data.Text.Region

Synopsis

Documentation

pt :: Int -> Int -> Point #

Make Point from line and column

start :: Point #

Point at the beginning

lineStart :: Int -> Point #

Point at the beginning of line

regionLength :: Lens' Region Size #

Regions length

till :: Point -> Point -> Region #

Region from one Point to another

linesSize :: Int -> Size #

Distance of n lines

line :: Int -> Region #

n'th line region, starts at the beginning of line and ends on the next line

regionSize :: Point -> Size -> Region #

Make Region by start position and Size

expandLines :: Region -> Region #

Expand Region to contain full lines

atRegion :: Editable s => Region -> Lens' (Contents s) (Contents s) #

Get contents at Region

overlaps :: Region -> Region -> Bool #

Does regions overlaps

cutMap :: Region -> Map #

Cut Region mapping

insertMap :: Region -> Map #

Opposite to cutMap

cutRegion :: Region -> Region -> Region #

Update second Region position as if it was data cutted at first Region

insertRegion :: Region -> Region -> Region #

Update second region position as if it was data inserted at first region (region sets insertion point and data size) Region tries not to extend if data inserted at region bound except when region is empty This allows define replace as cut and insert in special case when we replace region itself

class Editable s => EditAction e s where #

Minimal complete definition

replaceAction, actionMap, perform, inversed

Methods

replaceAction :: Region -> Contents s -> e s #

Make replace action over Region and Contents

actionMap :: e s -> Map #

Make Map from action

perform :: e s -> Contents s -> Contents s #

Perform action, modifying Contents

inversed :: e s -> Contents s -> e s #

Get action undo

Instances

replace :: EditAction e s => Region -> s -> e s #

Replace region with data

cut :: EditAction e s => Region -> e s #

Cuts region

paste :: EditAction e s => Point -> s -> e s #

Pastes Contents at some Point

overwrite :: EditAction e s => Point -> s -> e s #

Overwrites Contents at some Point

apply :: Editable s => Edit s -> s -> s #

update :: (Editable s, Regioned r) => Edit s -> r -> r #

Update regions

undo :: Editable s => Edit s -> s -> Edit s #

Get undo