Text editor: Introduce per project settings

With some refactorings to make the code look better.

Reviewed-by: con
This commit is contained in:
Leandro Melo
2011-02-01 14:13:54 +01:00
parent cbafc50acc
commit ea313f3ec8
46 changed files with 1955 additions and 912 deletions

View File

@@ -263,7 +263,8 @@ bool AutoCompleter::autoBackspace(QTextCursor &cursor)
return false;
}
int AutoCompleter::paragraphSeparatorAboutToBeInserted(QTextCursor &cursor)
int AutoCompleter::paragraphSeparatorAboutToBeInserted(QTextCursor &cursor,
const TabSettings &tabSettings)
{
if (!m_autoParenthesesEnabled)
return 0;
@@ -289,17 +290,16 @@ int AutoCompleter::paragraphSeparatorAboutToBeInserted(QTextCursor &cursor)
if (condition) {|
statement;
*/
const TabSettings &ts = TextEditorSettings::instance()->tabSettings();
QTextBlock block = cursor.block();
int indentation = ts.indentationColumn(block.text());
int indentation = tabSettings.indentationColumn(block.text());
if (block.next().isValid()) { // not the last block
block = block.next();
//skip all empty blocks
while (block.isValid() && ts.onlySpace(block.text()))
while (block.isValid() && tabSettings.onlySpace(block.text()))
block = block.next();
if (block.isValid()
&& ts.indentationColumn(block.text()) > indentation)
&& tabSettings.indentationColumn(block.text()) > indentation)
return 0;
}