1. paradoxiology
  2. Lime


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
  • Branches default

Comments (0)

Files changed (2)

File Lime.cabal

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

File src/Range.hs

View file
 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