From 26ca5204bd3814a6e5fc8119adc74f368a66ce51 Mon Sep 17 00:00:00 2001 From: Evan Teran Date: Sat, 11 Jan 2025 02:18:44 -0500 Subject: [PATCH] better string conversion --- src/Preferences.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Preferences.cpp b/src/Preferences.cpp index ff8a0b39..ee1eb968 100644 --- a/src/Preferences.cpp +++ b/src/Preferences.cpp @@ -95,9 +95,9 @@ std::optional readLanguageModeYaml(const YAML::Node &language) { const YAML::Node value = it->second; if (key == "name") { - lm.name = QString::fromUtf8(value.as().c_str()); + lm.name = QString::fromStdString(value.as()); } else if (key == "delimiters") { - lm.delimiters = QString::fromUtf8(value.as().c_str()); + lm.delimiters = QString::fromStdString(value.as()); } else if (key == "tab_distance") { lm.tabDist = value.as(); } else if (key == "em_tab_distance") { @@ -105,9 +105,9 @@ std::optional readLanguageModeYaml(const YAML::Node &language) { } else if (key == "insert_tabs") { lm.insertTabs = value.as(); } else if (key == "regex") { - lm.recognitionExpr = QString::fromUtf8(value.as().c_str()); + lm.recognitionExpr = QString::fromStdString(value.as()); } else if (key == "wrap") { - auto string_val = QString::fromUtf8(value.as().c_str()); + auto string_val = QString::fromStdString(value.as()); auto it = std::find(std::begin(AutoWrapTypes), std::end(AutoWrapTypes), string_val); if (it == std::end(AutoWrapTypes)) { Raise(tr("unrecognized wrap style")); @@ -115,7 +115,7 @@ std::optional readLanguageModeYaml(const YAML::Node &language) { lm.wrapStyle = static_cast(it - std::begin(AutoWrapTypes)); } else if (key == "indent") { - auto string_val = QString::fromUtf8(value.as().c_str()); + auto string_val = QString::fromStdString(value.as()); auto it = std::find(std::begin(AutoIndentTypes), std::end(AutoIndentTypes), string_val); if (it == std::end(AutoIndentTypes)) { Raise(tr("unrecognized indent style")); @@ -123,7 +123,7 @@ std::optional readLanguageModeYaml(const YAML::Node &language) { lm.indentStyle = static_cast(it - std::begin(AutoIndentTypes)); } else if (key == "default_tips") { - lm.defTipsFile = QString::fromUtf8(value.as().c_str()); + lm.defTipsFile = QString::fromStdString(value.as()); } else if (key == "extensions") { QStringList extensions; for (size_t i = 0; i < value.size(); i++) {