From 904ab6d6fa58407d3727fc6c2b061a21e9f05e6b Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Tue, 23 Jul 2019 17:05:44 +0200 Subject: [PATCH] Add property tests for PositionMapping (#2265) --- src/Development/IDE/Core/PositionMapping.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Development/IDE/Core/PositionMapping.hs b/src/Development/IDE/Core/PositionMapping.hs index c29b77da..6706716c 100644 --- a/src/Development/IDE/Core/PositionMapping.hs +++ b/src/Development/IDE/Core/PositionMapping.hs @@ -41,8 +41,8 @@ applyChange posMapping _ = posMapping toCurrent :: Range -> T.Text -> Position -> Maybe Position toCurrent (Range (Position startLine startColumn) (Position endLine endColumn)) t (Position line column) - | line < startLine || line == startLine && column <= startColumn = - -- Position is before the change and thereby unchanged + | line < startLine || line == startLine && column < startColumn = + -- Position is before the change and thereby unchanged. Just $ Position line column | line > endLine || line == endLine && column >= endColumn = -- Position is after the change so increase line and column number @@ -63,7 +63,7 @@ toCurrent (Range (Position startLine startColumn) (Position endLine endColumn)) fromCurrent :: Range -> T.Text -> Position -> Maybe Position fromCurrent (Range (Position startLine startColumn) (Position endLine endColumn)) t (Position line column) - | line < startLine || line == startLine && column <= startColumn = + | line < startLine || line == startLine && column < startColumn = -- Position is before the change and thereby unchanged Just $ Position line column | line > newEndLine || line == newEndLine && column >= newEndColumn =