Skip to content

Commit

Permalink
Merge pull request #233 from SublimeLinter/do-not-assume-endline-info
Browse files Browse the repository at this point in the history
Fallback if 'endLine' and 'endColumn' is not present
  • Loading branch information
kaste authored Mar 19, 2018
2 parents 07a498f + 3bdcb74 commit e83f0b8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,14 @@ def reposition_match(self, line, col, m, vv):
match = m.match
if (
col is None or
match.get('fatal', False) # parse error
'endLine' not in match or
'endColumn' not in match
):
text = vv.select_line(line)
return line, 0, len(text) # select whole line
return super().reposition_match(line, col, m, vv)

# apply line_col_base manually
end_line = match.get('endLine', line + 1) - 1
# to ensure a length of 1, add 2 to the starting col
end_column = match.get('endColumn', col + 2) - 1
end_line = match['endLine'] - 1
end_column = match['endColumn'] - 1

for _line in range(line, end_line):
text = vv.select_line(_line)
Expand Down

0 comments on commit e83f0b8

Please sign in to comment.