text-region-0.3.1.0: Marking text regions

Safe HaskellNone
LanguageHaskell2010

Data.Text.Region

Synopsis

Documentation

pt :: Int -> Int -> Point Source #

Make Point from line and column

start :: Point Source #

Point at the beginning

lineStart :: Int -> Point Source #

Point at the beginning of line

till :: Point -> Point -> Region Source #

Region from one Point to another

linesSize :: Int -> Size Source #

Distance of n lines

line :: Int -> Region Source #

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

regionSize :: Point -> Size -> Region Source #

Make Region by start position and Size

expandLines :: Region -> Region Source #

Expand Region to contain full lines

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

Get contents at Region

overlaps :: Region -> Region -> Bool Source #

Does regions overlaps

cutMap :: Region -> Map Source #

Cut Region mapping

insertMap :: Region -> Map Source #

Opposite to cutMap

cutRegion :: Region -> Region -> Region Source #

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

insertRegion :: Region -> Region -> Region Source #

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 Source #

Minimal complete definition

replaceAction, actionMap, perform, inversed

Methods

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

Make replace action over Region and Contents

actionMap :: e s -> Map Source #

Make Map from action

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

Perform action, modifying Contents

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

Get action undo

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

Replace region with data

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

Cuts region

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

Pastes Contents at some Point

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

Overwrites Contents at some Point

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

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

Update regions

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

Get undo