Commit 32e444d9 authored by Marco Benelli's avatar Marco Benelli

qmljs: use IEditor to positioning cursor after reformat

Thanks to the IEditor interface, there is no more need to use the
editor's widget.

Change-Id: Ic316dd21572ec5c36e10c9213a6c5d19bd7c62e6
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 267167a0
......@@ -273,13 +273,12 @@ void QmlJSEditorPlugin::reformatFile()
tc.insertText(newText);
};
QmlJSEditorWidget *widget = EditorManager::currentEditor()
? qobject_cast<QmlJSEditorWidget*>(EditorManager::currentEditor()->widget())
: nullptr;
if (widget) {
const int position = widget->position();
IEditor *ed = EditorManager::currentEditor();
if (ed) {
int line = ed->currentLine();
int column = ed->currentColumn();
setNewText();
widget->setCursorPosition(position);
ed->gotoLine(line, column);
} else {
setNewText();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment