From d4698d43fd9138b887be935fc09752237fd802e6 Mon Sep 17 00:00:00 2001 From: iota97 Date: Fri, 8 Jul 2022 10:49:33 +0200 Subject: [PATCH] Double quote --- Common/Data/Format/IniFile.cpp | 8 ++++++++ assets/themes/defaultthemes.ini | 36 ++++++++++++++++----------------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Common/Data/Format/IniFile.cpp b/Common/Data/Format/IniFile.cpp index 0900e28499..32fcf43b68 100644 --- a/Common/Data/Format/IniFile.cpp +++ b/Common/Data/Format/IniFile.cpp @@ -61,6 +61,13 @@ static bool ParseLineKey(const std::string &line, size_t &pos, std::string *keyO static bool ParseLineValue(const std::string &line, size_t &pos, std::string *valueOut) { std::string value = ""; + std::string strippedLine = StripSpaces(line.substr(pos)); + if (strippedLine[0] == '"' && strippedLine[strippedLine.size()-1] == '"') { + // Don't remove comment if is surrounded by " " + value += line.substr(pos); + pos = line.npos; // Won't enter the while below + } + while (pos < line.size()) { size_t next = line.find('#', pos); if (next == line.npos) { @@ -117,6 +124,7 @@ static bool ParseLine(const std::string& line, std::string* keyOut, std::string* // 3. A \# in a line is not part of a comment and becomes # in the value. // 4. Whitespace around values is removed. // 5. Double quotes around values is removed. + // 6. Value surrounded by double quotes don't parsed to strip comment. if (line.size() < 2 || line[0] == ';') return false; diff --git a/assets/themes/defaultthemes.ini b/assets/themes/defaultthemes.ini index 98d7fe4e0e..3e167122bf 100644 --- a/assets/themes/defaultthemes.ini +++ b/assets/themes/defaultthemes.ini @@ -1,22 +1,22 @@ [Default] -Name = Default -ItemStyleFg = \#FFFFFFFF -ItemStyleBg = \#00000055 -ItemFocusedStyleFg = \#FFFFFFFF -ItemFocusedStyleBg = \#4CC2EDFF -ItemDownStyleFg = \#FFFFFFFF -ItemDownStyleBg = \#3999BDFF -ItemDisabledStyleFg = \#EEEEEE80 -ItemDisabledStyleBg = \#00000055 -HeaderStyleFg = \#FFFFFFFF -InfoStyleFg = \#FFFFFFFF -InfoStyleBg = \#00000000 -PopupTitleStyleFg = \#59BEE3FF -PopupStyleFg = \#FFFFFFFF -PopupStyleBg = \#303030FF -BackgroundColor = \#244D75FF -UIAtlas = ../ui_atlas +Name = "Default" +ItemStyleFg = "#FFFFFFFF" +ItemStyleBg = "#00000055" +ItemFocusedStyleFg = "#FFFFFFFF" +ItemFocusedStyleBg = "#4CC2EDFF" +ItemDownStyleFg = "#FFFFFFFF" +ItemDownStyleBg = "#3999BDFF" +ItemDisabledStyleFg = "#EEEEEE80" +ItemDisabledStyleBg = "#00000055" +HeaderStyleFg = "#FFFFFFFF" +InfoStyleFg = "#FFFFFFFF" +InfoStyleBg = "#00000000" +PopupTitleStyleFg = "#59BEE3FF" +PopupStyleFg = "#FFFFFFFF" +PopupStyleBg = "#303030FF" +BackgroundColor = "#244D75FF" +UIAtlas = "../ui_atlas" -# Colors are either in the format \#RGBA or 0xABGR (e.g. green is \#00FF00FF or 0xFF00FF00) +# Colors are either in the format "#RGBA" or 0xABGR (e.g. green is \#00FF00FF or 0xFF00FF00) # Atlas should be in the format path/to/filename where both filename.zim and filename.meta are # Unprovided entry will use the default value \ No newline at end of file