Skip to content

Commit

Permalink
Fixing column negative
Browse files Browse the repository at this point in the history
  • Loading branch information
wiliansilvazup committed Sep 15, 2020
1 parent 71958ab commit 3e90fc1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion text/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3e90fc1

Please sign in to comment.