Commit 67c459aa authored by heretik's avatar heretik
Browse files

fix syntax

parent 0e95b962
......@@ -209,10 +209,10 @@ void MainWindow::update_blocks()
void MainWindow::execute_next_command()
{
const Command &command = commands_.at( current_command_index_ );
const auto &command = commands_.at( current_command_index_ );
append_text( command.introduction, Qt::darkGreen );
process_.start( QString::fromStdString( command.command ) );
bool started = process_.waitForStarted();
auto started = process_.waitForStarted();
if( not started ) {
const auto msg = tr( "failed to start '" ) + process_.program() + '\'';
append_text( msg.toStdString(), Qt::darkRed );
......
......@@ -57,14 +57,14 @@ SyntaxHighlighter::SyntaxHighlighter( QTextDocument *parent )
first = false;
}
os << ")\\b";
QTextCharFormat format_keyword;
auto format_keyword = QTextCharFormat{};
format_keyword.setForeground( Qt::darkMagenta );
format_keyword.setFontWeight( QFont::Bold );
regex_and_formats_.emplace_back( QRegularExpression{ QString::fromStdString( os.str() ) }, format_keyword );
// other regexs
for( const auto &[ regex, color ] : regex_and_colors ) {
QTextCharFormat format;
auto format = QTextCharFormat{};
format.setForeground( color );
regex_and_formats_.emplace_back( QRegularExpression{ regex }, format );
}
......@@ -86,9 +86,9 @@ void SyntaxHighlighter::highlightBlock( const QString &text )
for( const auto &[ regex, format ] : regex_and_formats_ ) {
auto merged_format = format;
merged_format.merge( format_to_merge );
QRegularExpressionMatchIterator matchIterator = regex.globalMatch( text );
auto matchIterator = regex.globalMatch( text );
while( matchIterator.hasNext() ) {
QRegularExpressionMatch match = matchIterator.next();
auto match = matchIterator.next();
setFormat( match.capturedStart(), match.capturedLength(), merged_format );
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment