diff --git a/src/mathjax-suggest.ts b/src/mathjax-suggest.ts index 4287751159..2bbd1787bd 100644 --- a/src/mathjax-suggest.ts +++ b/src/mathjax-suggest.ts @@ -151,13 +151,7 @@ export default class MathjaxSuggest extends EditorSuggest { } getTextBeforeCursor(pos: EditorPosition): string { - let text = ""; - for (let i = 0; i < pos.line; i++) { - text += this.editor.getLine(i) + " "; - } - - text += this.getCurrentLineBeforeCursor(pos); - return text; + return this.editor.getRange({ ch: 0, line: 0 }, pos); }