summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/highlighter.cc4
-rw-r--r--src/highlighter.h4
-rw-r--r--src/mainwin.cc8
3 files changed, 8 insertions, 8 deletions
diff --git a/src/highlighter.cc b/src/highlighter.cc
index ab0a071..98eff8c 100644
--- a/src/highlighter.cc
+++ b/src/highlighter.cc
@@ -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";
diff --git a/src/highlighter.h b/src/highlighter.h
index 322ba2d..09bba39 100644
--- a/src/highlighter.h
+++ b/src/highlighter.h
@@ -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 );
diff --git a/src/mainwin.cc b/src/mainwin.cc
index 8834b75..6bb43e6 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -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();
}
}
contact: Jan Huwald // Impressum