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 =