Skip to content

Commit 87f8170

Browse files
authored
Merge pull request processing#2002 from 3ru/fix/scroll-position
Fixed scroll position after code reformatting
2 parents 42ecd5d + cccf5ac commit 87f8170

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

client/modules/IDE/components/Editor.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,11 @@ class Editor extends React.Component {
345345
plugins
346346
}
347347
);
348+
const { left, top } = this._cm.getScrollInfo();
348349
this._cm.doc.setValue(formatted);
349350
this._cm.focus();
350351
this._cm.doc.setCursor(this._cm.doc.posFromIndex(cursorOffset));
352+
this._cm.scrollTo(left, top);
351353
} catch (error) {
352354
console.error(error);
353355
}

0 commit comments

Comments
 (0)