text-rope-zipper-0.1.1.0: 2D text zipper based on text-rope
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Text.Lazy.Zipper

Synopsis

Documentation

data TextZipper Source #

Constructors

TextZipper 

Fields

Instances

Instances details
IsString TextZipper Source # 
Instance details

Defined in Data.Text.Lazy.Zipper

Monoid TextZipper Source # 
Instance details

Defined in Data.Text.Lazy.Zipper

Semigroup TextZipper Source # 
Instance details

Defined in Data.Text.Lazy.Zipper

Generic TextZipper Source # 
Instance details

Defined in Data.Text.Lazy.Zipper

Associated Types

type Rep TextZipper :: Type -> Type #

Show TextZipper Source # 
Instance details

Defined in Data.Text.Lazy.Zipper

Eq TextZipper Source # 
Instance details

Defined in Data.Text.Lazy.Zipper

type Rep TextZipper Source # 
Instance details

Defined in Data.Text.Lazy.Zipper

type Rep TextZipper = D1 ('MetaData "TextZipper" "Data.Text.Lazy.Zipper" "text-rope-zipper-0.1.1.0-HAGBUET0rKNACL7VfOnWus" 'False) (C1 ('MetaCons "TextZipper" 'PrefixI 'True) (S1 ('MetaSel ('Just "beforeCursor") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "afterCursor") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "cursor") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Position))))

moveCursor :: (Position -> Position) -> TextZipper -> TextZipper Source #

Modify the cursor position, updating the TextZipper according to the change.

setCursor :: Position -> TextZipper -> TextZipper Source #

Set the position of the Cursor to a specific value. The state of the TextZipper will be updated to match the new position.

hasTrailingNewline :: TextZipper -> Bool Source #

Whether the TextZipper has a trailing newline. A trailing newline is present if the last character of the line is a '\n' character.

removeTrailingNewline :: Text -> Text Source #

Helper function to remove the last character of the provided text iff it is a trailing newline.

null :: TextZipper -> Bool Source #

Whether the provided TextZipper is empty.

length :: TextZipper -> Int64 Source #

The length of the entire TextZipper structure.

toText :: TextZipper -> Text Source #

Convert a TextZipper to Text. Effectively 'beforeCursor <> afterCursor', but slightly more efficient in edge cases.

fromText :: Text -> TextZipper Source #

Create a TextZipper from a Text source, with the cursor at the end of it.

fromTextAt :: Text -> Position -> TextZipper Source #

Create a TextZipper from a Text source, with the cursor at the specified position.

fromParts :: Text -> Text -> TextZipper Source #

Create a TextZipper by concatenating two Text components, with the cursor between them.

insert :: Text -> TextZipper -> TextZipper Source #

Insert Text before the current Cursor position, updating its position according to the provided Text's length.

deleteBefore :: TextZipper -> TextZipper Source #

Delete the first character before the cursor, if any.

deleteAfter :: TextZipper -> TextZipper Source #

Delete the first character after the cursor, if any.

moveBackward :: TextZipper -> TextZipper Source #

Decrement the cursor.

moveForward :: TextZipper -> TextZipper Source #

Increment the cursor.

moveStart :: TextZipper -> TextZipper Source #

Move the cursor to the beginning of the text.

moveEnd :: TextZipper -> TextZipper Source #

Move the cursor to the end of the text.