From 3e90fc157d890e0ae8542c390c1252f3036bd319 Mon Sep 17 00:00:00 2001 From: Wilian Gabriel Date: Tue, 15 Sep 2020 13:24:09 -0300 Subject: [PATCH] Fixing column negative --- text/file.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/text/file.go b/text/file.go index a5c7bfa..7804ea2 100644 --- a/text/file.go +++ b/text/file.go @@ -106,7 +106,11 @@ func (textfile TextFile) FindLineAndColumn(findingIndex int) (line, column int) // now we access the textual index in the slice to ge the column endOfCurrentLineInTheFile := textfile.newlineEndingIndexes[endOfCurrentLine] - column = (findingIndex - 1) - endOfCurrentLineInTheFile + if findingIndex == 0 { + column = endOfCurrentLineInTheFile + } else { + column = (findingIndex - 1) - endOfCurrentLineInTheFile + } } return