Skip to content

Commit 7f0547a

Browse files
authored
fix: The functions in the library cannot be modified after being defined (#1938)
1 parent 3ea41c3 commit 7f0547a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ui/src/components/codemirror-editor/index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ defineOptions({ name: 'CodemirrorEditor' })
2222
function getRangeFromLineAndColumn(state: any, line: number, column: number, end_column?: number) {
2323
const l = state.doc.line(line)
2424
const form = l.from + column
25-
return { form: form > l.to ? l.to : form, to: end_column ? l.from + end_column : l.to }
25+
const to_end_column = l.from + end_column
26+
return {
27+
form: form > l.to ? l.to : form,
28+
to: end_column && to_end_column < l.to ? to_end_column : l.to
29+
}
2630
}
2731
2832
const regexpLinter = linter(async (view) => {

0 commit comments

Comments
 (0)