mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-06 21:11:35 -07:00
Smarter sorting and application of fix to handle multiple replacements
This commit is contained in:
parent
d5ba41035b
commit
3471ad45b1
3 changed files with 57 additions and 39 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue