forked from qt-creator/qt-creator
		
	TextEditors: Avoid sending contentsChanged signal when rehighlighting
That avoids a complete reparse of the document when font settings change, but in turn now requires an explicit redo of semantic highlighting in that case. The cpp editor part of this patch is actually still doing semantic parsing though. This will be fixed up in a later patch. Change-Id: I6f51a18cba6325856c96e155700eb912f6d3aad5 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
		@@ -1557,6 +1557,7 @@ void CPPEditorWidget::applyFontSettings()
 | 
			
		||||
 | 
			
		||||
    // this also makes the document apply font settings
 | 
			
		||||
    TextEditor::BaseTextEditorWidget::applyFontSettings();
 | 
			
		||||
    semanticRehighlight(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CPPEditorWidget::unCommentSelection()
 | 
			
		||||
 
 | 
			
		||||
@@ -569,6 +569,10 @@ void QmlJSTextEditorWidget::applyFontSettings()
 | 
			
		||||
{
 | 
			
		||||
    TextEditor::BaseTextEditorWidget::applyFontSettings();
 | 
			
		||||
    m_semanticHighlighter->updateFontSettings(baseTextDocument()->fontSettings());
 | 
			
		||||
    if (!m_qmlJsEditorDocument->isSemanticInfoOutdated()) {
 | 
			
		||||
        m_semanticHighlighter->rerun(m_qmlJsEditorDocument->semanticInfo());
 | 
			
		||||
        updateUses();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -58,11 +58,9 @@ public:
 | 
			
		||||
 | 
			
		||||
    inline void rehighlight(QTextCursor &cursor, QTextCursor::MoveOperation operation) {
 | 
			
		||||
        inReformatBlocks = true;
 | 
			
		||||
        cursor.beginEditBlock();
 | 
			
		||||
        int from = cursor.position();
 | 
			
		||||
        cursor.movePosition(operation);
 | 
			
		||||
        reformatBlocks(from, 0, cursor.position() - from);
 | 
			
		||||
        cursor.endEditBlock();
 | 
			
		||||
        inReformatBlocks = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user