Commits

chao committed c32e682

Fix a bug where negative last line can be interpreted incorrectly (v0.1.1.1)

The negative last line '-1' is not treated correctly when it's used like this:
lime '-1p'

  • Participants
  • Parent commits a0006a3

Comments (0)

Files changed (2)

 -- see http://haskell.org/cabal/users-guide/
 
 name:                Lime
-version:             0.1.1.0
+version:             0.1.1.1
 synopsis:            A quick and dirty sed and ack replacement for line/field manipulation
 -- description:         
 license:             MIT

File src/Range.hs

 mkRangeTo t = (RangeStart, RangeMiddle t)
 
 mkRangeAt ::  Int -> (RangePos, RangePos)
-mkRangeAt a = (RangeMiddle a, RangeMiddle (a+1))
+-- Special case for the last element
+mkRangeAt (-1) = (RangeMiddle (-1), RangeEnd)
+
+mkRangeAt a = (RangeMiddle a, RangeMiddle (a + 1))
 
 -- List indexting for negative index
 at ::  [a] -> Int -> Int