fix: The functions in the library cannot be modified after being defined (#1938)

This commit is contained in:
shaohuzhang1 2024-12-30 10:36:11 +08:00 committed by GitHub
parent 3ea41c3297
commit 7f0547a8b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,7 +22,11 @@ defineOptions({ name: 'CodemirrorEditor' })
function getRangeFromLineAndColumn(state: any, line: number, column: number, end_column?: number) {
const l = state.doc.line(line)
const form = l.from + column
return { form: form > l.to ? l.to : form, to: end_column ? l.from + end_column : l.to }
const to_end_column = l.from + end_column
return {
form: form > l.to ? l.to : form,
to: end_column && to_end_column < l.to ? to_end_column : l.to
}
}
const regexpLinter = linter(async (view) => {