From 7d82f374628f18eb13122f8e4285fa8839586393 Mon Sep 17 00:00:00 2001 From: royqh1979 Date: Sun, 24 Oct 2021 15:17:31 +0800 Subject: [PATCH] - enhancement: "use utf8 by default" in editor's misc setting --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 1 + RedPandaIDE/mainwindow.cpp | 4 +++- RedPandaIDE/qsynedit/TextBuffer.h | 2 +- RedPandaIDE/qsynedit/TextPainter.cpp | 4 ++-- RedPandaIDE/systemconsts.h | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 35638d98..f31f5722 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,7 @@ Version 0.7.3 - enhancement: open project file by drag it to the editor area - fix: the "add bookmark" menu item is not correctly disabled on a bookmarked line - enhancement: "use utf8 by default" in editor's misc setting + - fix: syntax issues not correctly cleared when the file was saved as another name. Version 0.7.2 - fix: rainbow parenthesis stop functioning when change editor's general options diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 9e8b9d7d..dcc0cc35 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -305,6 +305,7 @@ bool Editor::saveAs(const QString &name, bool fromProject){ } } + clearSyntaxIssues(); pMainWindow->fileSystemWatcher()->removePath(mFilename); if (pSettings->codeCompletion().enabled() && mParser) mParser->invalidateFile(mFilename); diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 50292e62..c67f5cd0 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1679,7 +1679,9 @@ void MainWindow::updateTools() void MainWindow::newEditor() { try { - Editor * editor=mEditorList->newEditor("",ENCODING_AUTO_DETECT,false,true); + Editor * editor=mEditorList->newEditor("", + pSettings->editor().useUTF8ByDefault()?ENCODING_UTF8:ENCODING_AUTO_DETECT, + false,true); editor->activate(); updateForEncodingInfo(); } catch (FileError e) { diff --git a/RedPandaIDE/qsynedit/TextBuffer.h b/RedPandaIDE/qsynedit/TextBuffer.h index de23f9b0..626fa3c9 100644 --- a/RedPandaIDE/qsynedit/TextBuffer.h +++ b/RedPandaIDE/qsynedit/TextBuffer.h @@ -59,7 +59,7 @@ public: int rightBraces(int Index); int lengthOfLongestLine(); QString lineBreak() const; - const SynRangeState& ranges(int Index); + SynRangeState ranges(int Index); void setRange(int Index, const SynRangeState& ARange, int leftBraces, int rightBraces); QString getString(int Index); int count(); diff --git a/RedPandaIDE/qsynedit/TextPainter.cpp b/RedPandaIDE/qsynedit/TextPainter.cpp index 36d903e8..0bdd268a 100644 --- a/RedPandaIDE/qsynedit/TextPainter.cpp +++ b/RedPandaIDE/qsynedit/TextPainter.cpp @@ -479,8 +479,8 @@ void SynEditTextPainter::PaintHighlightToken(bool bFillToEOL) } else { bSel = bLineSelected; bComplexToken = false; -// bU1 = false; // to shut up compiler warning. -// bU2 = false; // to shut up compiler warning. + bU1 = false; // to shut up compiler warning. + bU2 = false; // to shut up compiler warning. } // Any token chars accumulated? if (TokenAccu.Columns > 0) { diff --git a/RedPandaIDE/systemconsts.h b/RedPandaIDE/systemconsts.h index d2bd5ff8..8a2b1816 100644 --- a/RedPandaIDE/systemconsts.h +++ b/RedPandaIDE/systemconsts.h @@ -3,7 +3,7 @@ #include -#define DEVCPP_VERSION "0.7.2" +#define DEVCPP_VERSION "0.7.3" #define APP_SETTSINGS_FILENAME "redpandacpp.ini" #ifdef Q_OS_WIN