diff --git a/src/ShellCheck/Formatter/TTY.hs b/src/ShellCheck/Formatter/TTY.hs index 27d5065b6e497dbd78c65c1526d653d379d56d3e..f54a0b30403f6a699b216cf3edf3803b3da2c99c 100644 --- a/src/ShellCheck/Formatter/TTY.hs +++ b/src/ShellCheck/Formatter/TTY.hs @@ -78,7 +78,14 @@ outputForFile color sys comments = do cuteIndent :: PositionedComment -> String cuteIndent comment = replicate (fromIntegral $ colNo comment - 1) ' ' ++ - "^-- " ++ code (codeNo comment) ++ ": " ++ messageText comment + makeArrow ++ " " ++ code (codeNo comment) ++ ": " ++ messageText comment + where + arrow n = '^' : replicate (fromIntegral $ n-2) '-' ++ "^" + makeArrow = + let sameLine = lineNo comment == endLineNo comment + delta = endColNo comment - colNo comment + in + if sameLine && delta > 2 && delta < 32 then arrow delta else "^--" code code = "SC" ++ show code