trifecta 0.7.1 → 0.7.2
raw patch · 3 files changed
+13/−7 lines, 3 files
Files
- Text/Trifecta/Delta.hs +5/−1
- Text/Trifecta/Render.hs +7/−5
- trifecta.cabal +1/−1
Text/Trifecta/Delta.hs view
@@ -87,7 +87,11 @@ near s t = case (delta s, delta t) of (Directed p l _ _ _, Directed p' l' _ _ _) -> p == p' && l == l' (Lines l _ _ _, Lines l' _ _ _) -> l == l'- _ -> True+ (Columns _ _, Columns _ _) -> True+ (Columns _ _, Tab _ _ _) -> True+ (Tab _ _ _, Columns _ _) -> True+ (Tab _ _ _, Tab _ _ _) -> True+ _ -> False class HasDelta t where delta :: t -> Delta
Text/Trifecta/Render.hs view
@@ -71,10 +71,12 @@ class Renderable t where rendering :: t -> Rendering +instance Renderable Rendering where+ rendering = id+ class Source t where source :: t -> (Int, Line -> Line) - instance Source String where source s = (P.length s', draw [] 0 s') where s' = expand s @@ -100,9 +102,9 @@ addSpan :: Delta -> Delta -> Rendering -> Rendering addSpan s e r- | nl && nh = addSym r $ draw spanEffects (column l) $ P.replicate (max (column h - column l + 1) 0) '~' - | nl = addSym r $ draw spanEffects (column l) $ P.replicate (max (rLineLen r - column l) 0) '~' ++ ">"- | nh = addSym r $ draw spanEffects (-1) $ '<' : P.replicate (column l) '~'+ | nl && nh = addSym r $ draw spanEffects (column l) $ P.replicate (max (column h - column l + 1) 0) '~' + | nl = addSym r $ draw spanEffects (column l) $ P.replicate (max (rLineLen r - column l + 2) 0) '~'+ | nh = addSym r $ draw spanEffects (-1) $ P.replicate (max (column h + 1) 0) '~' | otherwise = r where l = argmin bytes s e @@ -142,7 +144,7 @@ window :: Int -> Int -> Int -> (Int, Int) window c l w - | c <= w2 = (0, w)+ | c <= w2 = (0, min w l) | c + w2 >= l = if l > w then (l-w, l) else (0, w) | otherwise = (c-w2,c + w2) where w2 = div w 2
trifecta.cabal view
@@ -1,6 +1,6 @@ name: trifecta category: Text, Parsing-version: 0.7.1+version: 0.7.2 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE