mirror of https://github.com/vitalif/openscad
fix for gcc. simplify mainwin.cc a bit.
parent
3ff8ca36b5
commit
f4f06d48d8
|
@ -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";
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue