Skip to content

Commit 08f1c52

Browse files
committed
Fixed Indentation on setCursor
1 parent 5abb3a5 commit 08f1c52

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

client/modules/IDE/components/Editor.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,17 +269,21 @@ class Editor extends React.Component {
269269
indent_size: INDENTATION_AMOUNT,
270270
indent_with_tabs: IS_TAB_INDENT
271271
};
272-
272+
console.log('inside');
273273
const mode = this._cm.getOption('mode');
274274
const currentPosition = this._cm.doc.getCursor();
275275
if (mode === 'javascript') {
276276
this._cm.doc.setValue(beautifyJS(this._cm.doc.getValue(), beautifyOptions));
277+
console.log('beautifying');
277278
} else if (mode === 'css') {
278279
this._cm.doc.setValue(beautifyCSS(this._cm.doc.getValue(), beautifyOptions));
279280
} else if (mode === 'htmlmixed') {
280281
this._cm.doc.setValue(beautifyHTML(this._cm.doc.getValue(), beautifyOptions));
281282
}
282-
this._cm.doc.setCursor({ line: currentPosition.line, ch: currentPosition.ch });
283+
setImmediate(() => {
284+
this._cm.focus();
285+
this._cm.doc.setCursor({ line: currentPosition.line, ch: currentPosition.ch + INDENTATION_AMOUNT });
286+
});
283287
}
284288

285289
initializeDocuments(files) {

0 commit comments

Comments
 (0)