From 5d728c36d509a36191052088a21272ae50c0c40e Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 27 Nov 2021 10:25:27 +0800 Subject: [PATCH] - enhancement: treat files ended with ".C" or ".CPP" as C++ files --- NEWS.md | 3 +++ RedPandaIDE/HighlighterManager.cpp | 4 +++- RedPandaIDE/utils.cpp | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 66d50f5e..d36ba18f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +Version 0.10.3 For Dev-C++ 7 Beta + - enhancement: treat files ended with ".C" or ".CPP" as C++ files + Version 0.10.2 For Dev-C++ 7 Beta - fix: select by mouse can't correctly set mouse's column position - fix: dragging out of the editor and back will cause error diff --git a/RedPandaIDE/HighlighterManager.cpp b/RedPandaIDE/HighlighterManager.cpp index f567ea31..413cb6b1 100644 --- a/RedPandaIDE/HighlighterManager.cpp +++ b/RedPandaIDE/HighlighterManager.cpp @@ -22,7 +22,9 @@ PSynHighlighter HighlighterManager::getHighlighter(const QString &filename) QString suffix = info.suffix(); if (suffix.isEmpty() || suffix == "c" || suffix == "cpp" || suffix == "cxx" || suffix == "cc" || suffix == "h" || suffix == "hpp" - || suffix == "hxx" || suffix == "hh") { + || suffix == "hxx" || suffix == "hh" || suffix == "C" + || suffix == "CPP" || suffix =="H" || suffix == "c++" + || suffix == "h++") { return getCppHighlighter(); } } diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp index 3dab6c78..a30da405 100644 --- a/RedPandaIDE/utils.cpp +++ b/RedPandaIDE/utils.cpp @@ -191,6 +191,12 @@ FileType getFileType(const QString &filename) if (filename.endsWith(".dev",PATH_SENSITIVITY)) { return FileType::Project; } + if (filename.endsWith(".C")) { + return FileType::CppSource; + } + if (filename.endsWith(".CPP")) { + return FileType::CppSource; + } if (filename.endsWith(".c",PATH_SENSITIVITY)) { return FileType::CSource; } @@ -206,6 +212,9 @@ FileType getFileType(const QString &filename) if (filename.endsWith(".c++",PATH_SENSITIVITY)) { return FileType::CppSource; } + if (filename.endsWith(".H")) { + return FileType::CHeader; + } if (filename.endsWith(".h",PATH_SENSITIVITY)) { return FileType::CHeader; }