fix: empty string linter overflow issues

This commit is contained in:
Andrew Bastin
2021-12-15 22:37:03 +05:30
parent 0022efe844
commit e4f40bce53

View File

@@ -102,8 +102,8 @@ const hoppLinterExt = (hoppLinter: LinterDefinition): Extension => {
const endPos = view.state.doc.line(result.to.line).from + result.to.ch - 1
return {
from: startPos,
to: endPos,
from: startPos < 0 ? 0 : startPos,
to: endPos > view.state.doc.length ? view.state.doc.length : endPos,
message: result.message,
severity: result.severity,
}