mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-08 18:25:17 +08:00
Smarter sorting and application of fix to handle multiple replacements
This commit is contained in:
@@ -180,7 +180,7 @@ data Position = Position {
|
||||
posFile :: String, -- Filename
|
||||
posLine :: Integer, -- 1 based source line
|
||||
posColumn :: Integer -- 1 based source column, where tabs are 8
|
||||
} deriving (Show, Eq, Generic, NFData)
|
||||
} deriving (Show, Eq, Generic, NFData, Ord)
|
||||
|
||||
newPosition :: Position
|
||||
newPosition = Position {
|
||||
@@ -209,6 +209,9 @@ data Replacement = Replacement {
|
||||
repString :: String
|
||||
} deriving (Show, Eq, Generic, NFData)
|
||||
|
||||
instance Ord Replacement where
|
||||
compare r1 r2 = (repStartPos r1) `compare` (repStartPos r2)
|
||||
|
||||
newReplacement = Replacement {
|
||||
repStartPos = newPosition,
|
||||
repEndPos = newPosition,
|
||||
|
Reference in New Issue
Block a user