forked from qt-creator/qt-creator
Refactor: Get rid of BaseTextEditorWidget from Indenter
Provide directly TabSettings instead. This will be used for indenting a text for which there is no editor instance. Change-Id: Ia5f11a481f42464cf4820efdf2c7c4c32166f55e Reviewed-on: http://codereview.qt.nokia.com/2622 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
@@ -32,7 +32,6 @@
|
||||
|
||||
#include "normalindenter.h"
|
||||
#include "tabsettings.h"
|
||||
#include "basetexteditor.h"
|
||||
|
||||
#include <QtGui/QTextDocument>
|
||||
|
||||
@@ -66,7 +65,7 @@ NormalIndenter::~NormalIndenter()
|
||||
void NormalIndenter::indentBlock(QTextDocument *doc,
|
||||
const QTextBlock &block,
|
||||
const QChar &typedChar,
|
||||
BaseTextEditorWidget *editor)
|
||||
const TextEditor::TabSettings &tabSettings)
|
||||
{
|
||||
Q_UNUSED(typedChar)
|
||||
|
||||
@@ -82,11 +81,10 @@ void NormalIndenter::indentBlock(QTextDocument *doc,
|
||||
|
||||
// Just use previous line.
|
||||
// Skip blank characters when determining the indentation
|
||||
const TabSettings &ts = editor->tabSettings();
|
||||
int i = 0;
|
||||
while (i < previousText.size()) {
|
||||
if (!previousText.at(i).isSpace()) {
|
||||
ts.indentLine(block, ts.columnAt(previousText, i));
|
||||
tabSettings.indentLine(block, tabSettings.columnAt(previousText, i));
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
|
||||
Reference in New Issue
Block a user