From 0286043cd7b891d9d0635b196708ba66d36e603c Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 12 Mar 2022 21:42:32 +0800 Subject: [PATCH] - fix: syntax color of #include header filenames not correct --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 4 +++- RedPandaIDE/settingsdialog/editormiscwidget.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index ae86ddf9..780f51ba 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,6 +12,7 @@ Red Panda C++ Version 1.0.0 - enhancement: clear infos in the status bar when editor closed - fix: wrong selection when drag & dropped in editor - enhancement: toggle block comment + - fix: syntax color of #include header filenames not correct Red Panda C++ Version 0.14.5 - fix: the "gnu c++ 20" option in compiler set options is wrong diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 78d3ec23..eed64fa7 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -886,7 +886,9 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to if (token.isEmpty()) return; - if (mParser && highlighter() && (attr == highlighter()->identifierAttribute())) { + if (mParser && highlighter() && (attr == highlighter()->identifierAttribute()) + && !mParser->isIncludeLine(lines()->getString(line-1)) ) { + BufferCoord p{aChar,line}; // BufferCoord pBeginPos,pEndPos; // QString s= getWordAtPosition(this,p, pBeginPos,pEndPos, WordPurpose::wpInformation); diff --git a/RedPandaIDE/settingsdialog/editormiscwidget.cpp b/RedPandaIDE/settingsdialog/editormiscwidget.cpp index c013056b..b9d3924d 100644 --- a/RedPandaIDE/settingsdialog/editormiscwidget.cpp +++ b/RedPandaIDE/settingsdialog/editormiscwidget.cpp @@ -72,7 +72,7 @@ void EditorMiscWidget::doSave() pSettings->editor().setAutoDetectFileEncoding(ui->chkAutoDetectFileEncoding->isChecked()); if (ui->cbEncodingDetail->isVisible()) { - pSettings->editor().setDefaultEncoding(ui->cbEncodingDetail->currentData().toByteArray()); + pSettings->editor().setDefaultEncoding(ui->cbEncodingDetail->currentText().toLocal8Bit()); } else { pSettings->editor().setDefaultEncoding(ui->cbEncoding->currentData().toByteArray()); }