diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index fa42d90ba..fdac986c7 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -1257,7 +1257,8 @@ LangType FileManager::detectLanguageFromTextBegining(const unsigned char *data, // it detectes xml, php and bash script file std::string xmlHeader = ""; // length : 6 std::string htmlHeader1 = ""; // length : 15 @@ -1272,8 +1273,13 @@ LangType FileManager::detectLanguageFromTextBegining(const unsigned char *data, std::string buf2Test = std::string((const char *)data + i, longestLength); - auto res = std::mismatch(bashHeader.begin(), bashHeader.end(), buf2Test.begin()); - if (res.first == bashHeader.end()) + auto res = std::mismatch(shebang1.begin(), shebang1.end(), buf2Test.begin()); + if (res.first == shebang1.end()) + { + return L_BASH; + } + res = std::mismatch(shebang2.begin(), shebang2.end(), buf2Test.begin()); + if (res.first == shebang2.end()) { return L_BASH; }