msg: Output column numbers starting from 1

Most of editors/IDEs expect column numbers to start from 1, so (1, 1) means
beginning of the file.

This change applies only to diagnostics output, however Nim will still
internally number columns starting from 0.
This commit is contained in:
Adam Strzelecki
2015-04-20 22:02:25 +02:00
parent d203d6fad4
commit 69ed78b30f

View File

@@ -804,8 +804,11 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string,
ignoreMsg = optHints notin gOptions or msg notin gNotes
frmt = PosHintFormat
inc(gHintCounter)
# NOTE: currently line info line numbers start with 1,
# but column numbers start with 0, however most editors expect
# first column to be 1, so we need to +1 here
let s = frmt % [toMsgFilename(info), coordToStr(info.line),
coordToStr(info.col), getMessageStr(msg, arg)]
coordToStr(info.col+1), getMessageStr(msg, arg)]
if not ignoreMsg and not ignoreMsgBecauseOfIdeTools(msg):
msgWriteln(s)
if optPrintSurroundingSrc and msg in errMin..errMax: