1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2024-11-23 00:33:44 +00:00

Set default.lang if user's lang is not found.

This commit is contained in:
King_DuckZ 2017-05-08 09:17:45 +01:00
parent 07135f215c
commit 9e1e18dcf0

View file

@ -55,9 +55,10 @@ namespace tawashi {
else { else {
srchilite::LangMap lang_map(m_langmap_dir, "lang.map"); srchilite::LangMap lang_map(m_langmap_dir, "lang.map");
lang_map.open(); lang_map.open();
m_lang_file.clear();
if (not query_str.empty()) if (not query_str.empty())
m_lang_file = lang_map.getFileName(query_str); m_lang_file = lang_map.getFileName(query_str);
else if (m_lang_file.empty())
m_lang_file = "default.lang"; m_lang_file = "default.lang";
} }
} }
@ -75,7 +76,6 @@ namespace tawashi {
highlighter.setDataDir(settings().as<std::string>("langmap_dir")); highlighter.setDataDir(settings().as<std::string>("langmap_dir"));
highlighter.setGenerateEntireDoc(false); highlighter.setGenerateEntireDoc(false);
highlighter.setGenerateLineNumbers(true); highlighter.setGenerateLineNumbers(true);
const auto lang = m_lang_file;
std::string processed_pastie; std::string processed_pastie;
if (m_syntax_highlight) { if (m_syntax_highlight) {
@ -89,7 +89,7 @@ namespace tawashi {
if (not m_plain_text and m_syntax_highlight) { if (not m_plain_text and m_syntax_highlight) {
std::istringstream iss(std::move(processed_pastie)); std::istringstream iss(std::move(processed_pastie));
std::ostringstream oss; std::ostringstream oss;
highlighter.highlight(iss, oss, lang); highlighter.highlight(iss, oss, m_lang_file);
processed_pastie = oss.str(); processed_pastie = oss.str();
} }