Safe Haskell | None |
---|---|
Language | Haskell2010 |
A normalized API to many buffer operations.
- data TextUnit
- isAnySep :: Char -> Bool
- isWordChar :: Char -> Bool
- leftBoundaryUnit :: TextUnit -> TextUnit
- outsideUnit :: TextUnit -> TextUnit
- unitDelimited :: Char -> Char -> Bool -> TextUnit
- unitEmacsParagraph :: TextUnit
- unitParagraph :: TextUnit
- unitSentence :: TextUnit
- unitSep :: TextUnit
- unitSepThisLine :: TextUnit
- unitViWORD :: TextUnit
- unitViWORDAnyBnd :: TextUnit
- unitViWORDOnLine :: TextUnit
- unitViWord :: TextUnit
- unitViWordAnyBnd :: TextUnit
- unitViWordOnLine :: TextUnit
- unitWord :: TextUnit
- atBoundaryB :: TextUnit -> Direction -> BufferM Bool
- deleteB :: TextUnit -> Direction -> BufferM ()
- doIfCharB :: (Char -> Bool) -> BufferM a -> BufferM ()
- doUntilB_ :: BufferM Bool -> BufferM a -> BufferM ()
- genMaybeMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()
- genMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM ()
- maybeMoveB :: TextUnit -> Direction -> BufferM ()
- moveB :: TextUnit -> Direction -> BufferM ()
- numberOfB :: TextUnit -> TextUnit -> BufferM Int
- readPrevUnitB :: TextUnit -> BufferM YiString
- readUnitB :: TextUnit -> BufferM YiString
- regionOfB :: TextUnit -> BufferM Region
- regionOfNonEmptyB :: TextUnit -> BufferM Region
- regionOfPartB :: TextUnit -> Direction -> BufferM Region
- regionOfPartNonEmptyAtB :: TextUnit -> Direction -> Point -> BufferM Region
- regionOfPartNonEmptyB :: TextUnit -> Direction -> BufferM Region
- transformB :: (YiString -> YiString) -> TextUnit -> Direction -> BufferM ()
- transposeB :: TextUnit -> Direction -> BufferM ()
- untilB :: BufferM Bool -> BufferM a -> BufferM [a]
- untilB_ :: BufferM Bool -> BufferM a -> BufferM ()
- whileB :: BufferM Bool -> BufferM a -> BufferM [a]
- data BoundarySide
- checkPeekB :: Int -> [Char -> Bool] -> Direction -> BufferM Bool
- genAtBoundaryB :: TextUnit -> Direction -> BoundarySide -> BufferM Bool
- data RegionStyle
- convertRegionToStyleB :: Region -> RegionStyle -> BufferM Region
- extendRegionToBoundaries :: TextUnit -> BoundarySide -> BoundarySide -> Region -> BufferM Region
- getRegionStyle :: BufferM RegionStyle
- mkRegionOfStyleB :: Point -> Point -> RegionStyle -> BufferM Region
- putRegionStyle :: RegionStyle -> BufferM ()
- unitWiseRegion :: TextUnit -> Region -> BufferM Region
Documentation
Designate a given "unit" of text.
isAnySep :: Char -> Bool Source #
Separator characters (space, tab, unicode separators). Most of the units above attempt to identify "words" with various punctuation and symbols included or excluded. This set of units is a simple inverse: it is true for "whitespace" or "separators" and false for anything that is not (letters, numbers, symbols, punctuation, whatever).
isWordChar :: Char -> Bool Source #
leftBoundaryUnit :: TextUnit -> TextUnit Source #
Unit that have its left and right boundaries at the left boundary of the argument unit.
outsideUnit :: TextUnit -> TextUnit Source #
unitDelimited :: Char -> Char -> Bool -> TextUnit Source #
delimited on the left and right by given characters, boolean argument tells if whether those are included.
unitEmacsParagraph :: TextUnit Source #
Paragraph to implement emacs-like forward-paragraph/backward-paragraph
unitParagraph :: TextUnit Source #
Paragraph that begins and ends in the paragraph, not the empty lines surrounding it.
unitSepThisLine :: TextUnit Source #
unitSepThisLine is true for any kind of whitespace/separator on this line only
deleteB :: TextUnit -> Direction -> BufferM () Source #
Delete between point and next unit boundary, return the deleted region.
doIfCharB :: (Char -> Bool) -> BufferM a -> BufferM () Source #
Do an action if the current buffer character passes the predicate
genMaybeMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM () Source #
Generic maybe move operation. As genMoveB, but don't move if we are at boundary already.
genMoveB :: TextUnit -> (Direction, BoundarySide) -> Direction -> BufferM () Source #
Generic move operation
Warning: moving To the (OutsideBound, Backward) bound of Document is impossible (offset -1!)
genMoveB u b d
: move in direction d until encountering boundary b or unit u. See genAtBoundaryB
for boundary explanation.
maybeMoveB :: TextUnit -> Direction -> BufferM () Source #
As moveB
, unless the point is at a unit boundary
regionOfB :: TextUnit -> BufferM Region Source #
Region of the whole textunit where the current point is.
regionOfNonEmptyB :: TextUnit -> BufferM Region Source #
Non empty region of the whole textunit where the current point is.
regionOfPartB :: TextUnit -> Direction -> BufferM Region Source #
Region between the point and the next boundary. The region is empty if the point is at the boundary.
regionOfPartNonEmptyAtB :: TextUnit -> Direction -> Point -> BufferM Region Source #
Non empty region at given point and the next boundary,
regionOfPartNonEmptyB :: TextUnit -> Direction -> BufferM Region Source #
Non empty region between the point and the next boundary, In fact the region can be empty if we are at the end of file.
untilB :: BufferM Bool -> BufferM a -> BufferM [a] Source #
Repeat an action until the condition is fulfilled or the cursor stops moving. The Action may be performed zero times.
genAtBoundaryB :: TextUnit -> Direction -> BoundarySide -> BufferM Bool Source #
genAtBoundaryB u d s
returns whether the point is at a given boundary (d,s)
.
Boundary (d,s)
, taking Word as example, means:
Word
^^ ^^
12 34
1: (Backward,OutsideBound)
2: (Backward,InsideBound)
3: (Forward,InsideBound)
4: (Forward,OutsideBound)
rules: genAtBoundaryB u Backward InsideBound = atBoundaryB u Backward genAtBoundaryB u Forward OutsideBound = atBoundaryB u Forward
data RegionStyle Source #
convertRegionToStyleB :: Region -> RegionStyle -> BufferM Region Source #
extendRegionToBoundaries :: TextUnit -> BoundarySide -> BoundarySide -> Region -> BufferM Region Source #
Extend the given region to boundaries of the text unit. For instance one can extend the selection to complete lines, or paragraphs.
mkRegionOfStyleB :: Point -> Point -> RegionStyle -> BufferM Region Source #
putRegionStyle :: RegionStyle -> BufferM () Source #