diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 5d4533230bb..8e6a466e8e0 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -289,10 +289,12 @@ void QmlJSEditorPluginPrivate::reformatFile() IEditor *ed = EditorManager::currentEditor(); if (ed) { + QByteArray state = ed->saveState(); int line = ed->currentLine(); int column = ed->currentColumn(); setNewText(); - ed->gotoLine(line, column); + ed->gotoLine(line, column - 1); + ed->restoreState(state); } else { setNewText(); }