forked from qt-creator/qt-creator
qmljseditor: preserve state when reformatting
Only editing position was preserved (and incorrect column) when reformatting qml, preserve also scoll position (and correct column position). Fixes: QTCREATORBUG-25507 Change-Id: Ieaec2c5390e437f32b4b97b2bbb47975895f96d8 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user