fix for gcc. simplify mainwin.cc a bit.

felipesanches-svg
don bright 2013-01-13 00:01:24 +01:00
parent 3ff8ca36b5
commit f4f06d48d8
3 changed files with 8 additions and 8 deletions

View File

@ -160,6 +160,8 @@ Highlighter::Highlighter(QTextDocument *parent)
commentFormat.setForeground(Qt::darkCyan);
errorFormat.setBackground(Qt::red);
errorState = false;
errorPos = -1;
lastErrorBlock = parent->begin();
}
@ -209,7 +211,7 @@ void Highlighter::portable_rehighlightBlock( const QTextBlock &block )
void Highlighter::highlightBlock(const QString &text)
{
int block_first_pos = currentBlock().position();
int block_last_pos = block_first_pos + currentBlock().length() - 1;
//int block_last_pos = block_first_pos + currentBlock().length() - 1;
//std::cout << "block[" << block_first_pos << ":" << block_last_pos << "]"
// << ", err:" << errorPos << "," << errorState
// << ", text:'" << text.toStdString() << "'\n";

View File

@ -15,8 +15,8 @@ public:
void unhighlightLastError();
private:
QTextBlock lastErrorBlock;
int errorPos = -1;
bool errorState = false;
int errorPos;
bool errorState;
QMap<QString,QStringList> tokentypes;
QMap<QString,QTextCharFormat> typeformats;
void portable_rehighlightBlock( const QTextBlock &text );

View File

@ -1037,14 +1037,12 @@ bool MainWindow::compileTopLevelDocument(bool reload)
false);
if (!animate_panel->isVisible()) {
highlighter->unhighlightLastError();
if (!this->root_module) {
highlighter->unhighlightLastError();
QTextCursor cursor = editor->textCursor();
cursor.setPosition( parser_error_pos );
editor->setTextCursor( cursor );
cursor.setPosition(parser_error_pos);
editor->setTextCursor(cursor);
highlighter->highlightError( parser_error_pos );
} else {
highlighter->unhighlightLastError();
}
}