diff --git a/src/eepp/ui/doc/syntaxtokenizer.cpp b/src/eepp/ui/doc/syntaxtokenizer.cpp index a8941c6fe..56dcfc535 100644 --- a/src/eepp/ui/doc/syntaxtokenizer.cpp +++ b/src/eepp/ui/doc/syntaxtokenizer.cpp @@ -251,6 +251,7 @@ static inline void popStack( SyntaxStateRestored& curState, SyntaxState& retStat if ( retState.langStack[curState.currentLevel] != 0 && retState.langStack[curState.currentLevel] != syntax.getLanguageIndex() ) { + retState.langStack[curState.currentLevel] = 0; setSubsyntaxPatternIdx( curState, retState, SyntaxStateType{} ); // Remove all the removed language stack diff --git a/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/typst.cpp b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/typst.cpp index f9cd2c4d6..47465d7c2 100644 --- a/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/typst.cpp +++ b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/typst.cpp @@ -8,7 +8,7 @@ SyntaxDefinition& addTypst() { return SyntaxDefinitionManager::instance() ->add( - { "typst", + { "Typst", { "%.typ$" }, { { { "include", "#markup" }, diff --git a/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languagessyntaxhighlighting.cpp b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languagessyntaxhighlighting.cpp index 96df53b9f..328f37d84 100644 --- a/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languagessyntaxhighlighting.cpp +++ b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languagessyntaxhighlighting.cpp @@ -414,6 +414,9 @@ void LanguagesSyntaxHighlighting::load() { { "%.lisp$", "%.cl$", "%.el$" }, } ); + sdm->addPreDefinition( + { "L.B. Stanza", []() -> SyntaxDefinition& { return addLbstanza(); }, { "%.stanza$" } } ); + sdm->addPreDefinition( { "Lobster", []() -> SyntaxDefinition& { return addLobster(); }, @@ -626,7 +629,7 @@ void LanguagesSyntaxHighlighting::load() { { "ts" } } ); sdm->addPreDefinition( - { "typst", []() -> SyntaxDefinition& { return addTypst(); }, { "%.typ$" } } ); + { "Typst", []() -> SyntaxDefinition& { return addTypst(); }, { "%.typ$" } } ); sdm->addPreDefinition( { "Ü", diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index d899ed703..92c222c7b 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -4112,6 +4112,9 @@ static void exportLanguages( const std::string& path, const std::string& langs, SyntaxDefinitionManager::instance()->loadFromFolder( langsPath ); std::vector defs; + for ( auto& preDef : sdm->getPreDefinitions() ) + preDef.load(); + if ( !langs.empty() ) { if ( langs == "all" ) { defs = sdm->getDefinitions(); diff --git a/src/tools/ecode/universallocator.cpp b/src/tools/ecode/universallocator.cpp index 9fe452168..3162a46db 100644 --- a/src/tools/ecode/universallocator.cpp +++ b/src/tools/ecode/universallocator.cpp @@ -1,7 +1,7 @@ +#include "universallocator.hpp" #include "ecode.hpp" #include "pathhelper.hpp" #include "settingsmenu.hpp" -#include "universallocator.hpp" #include @@ -932,18 +932,24 @@ std::shared_ptr> UniversalLocator::openFileTypeModel( const std::string& pattern ) { if ( nullptr == mApp->getSplitter()->getCurEditor() ) return ItemListOwnerModel::create( {} ); + const auto& preDefs = SyntaxDefinitionManager::instance()->getPreDefinitions(); const auto& defs = SyntaxDefinitionManager::instance()->getDefinitions(); - std::vector fileTypeNames; - fileTypeNames.reserve( defs.size() ); + std::set fileTypeNames; + for ( const auto& def : preDefs ) { + if ( pattern.empty() || String::startsWith( String::toLower( def.getLanguageName() ), + String::toLower( pattern ) ) ) + fileTypeNames.insert( def.getLanguageName() ); + } for ( const auto& def : defs ) { if ( !def.isVisible() ) continue; if ( pattern.empty() || String::startsWith( String::toLower( def.getLanguageName() ), String::toLower( pattern ) ) ) - fileTypeNames.push_back( def.getLanguageName() ); + fileTypeNames.insert( def.getLanguageName() ); } - std::sort( fileTypeNames.begin(), fileTypeNames.end() ); - return ItemListOwnerModel::create( fileTypeNames ); + return ItemListOwnerModel::create( + std::vector( std::make_move_iterator( fileTypeNames.begin() ), + std::make_move_iterator( fileTypeNames.end() ) ) ); } void UniversalLocator::updateSwitchFileTypeTable() {