MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / SetBufferMode

Method SetBufferMode

external/zep/src/editor.cpp:679–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

677 }
678
679 void ZepEditor::SetBufferMode(ZepBuffer& buffer) const {
680 // Reset it in case we are changing the text in a buffer
681 buffer.SetMode(nullptr);
682
683 std::string ext;
684 std::string fileName;
685 if (buffer.GetFilePath().has_filename() && buffer.GetFilePath().filename().has_extension()) {
686 ext = string_tolower(buffer.GetFilePath().filename().extension().string());
687 fileName = string_tolower(buffer.GetFilePath().filename().string());
688 } else {
689 auto str = buffer.GetName();
690 size_t dot_pos = str.find_last_of(".");
691 if (dot_pos != std::string::npos) {
692 ext = string_tolower(str.substr(dot_pos, str.length() - dot_pos));
693 }
694 }
695
696 auto itr = m_mapBufferModes.find(ext);
697 if (itr != m_mapBufferModes.end()) {
698 buffer.SetMode(itr->second);
699 }
700 }
701
702 void ZepEditor::SetBufferSyntax(ZepBuffer& buffer) const {
703 std::string ext;

Callers

nothing calls this directly

Calls 8

string_tolowerFunction · 0.85
SetModeMethod · 0.80
GetFilePathMethod · 0.80
stringMethod · 0.80
GetNameMethod · 0.80
lengthMethod · 0.80
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected