From d93bd635b42a68118c3623753122d167f9c90499 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Sun, 4 Dec 2016 17:28:57 +0100 Subject: [PATCH] fix(label): Remove surrounding quotes Fixes #221 --- src/components/builder.cpp | 8 +------- src/drawtypes/label.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/builder.cpp b/src/components/builder.cpp index 05db9286..36e708d3 100644 --- a/src/components/builder.cpp +++ b/src/components/builder.cpp @@ -55,13 +55,7 @@ string builder::flush() { * Insert raw text string */ void builder::append(string text) { - string str(move(text)); - size_t len{str.length()}; - if (len > 2 && str[0] == '"' && str[len - 1] == '"') { - m_output += str.substr(1, len - 2); - } else { - m_output += str; - } + m_output += text; } /** diff --git a/src/drawtypes/label.cpp b/src/drawtypes/label.cpp index fd74a763..cf7e4c61 100644 --- a/src/drawtypes/label.cpp +++ b/src/drawtypes/label.cpp @@ -135,6 +135,12 @@ namespace drawtypes { text = conf.get(section, name, move(def)); } + size_t len{text.size()}; + + if (len > 2 && text[0] == '"' && text[len - 1] == '"') { + text = text.substr(1, len - 2); + } + const auto get_left_right = [&](string key) { auto value = conf.get(section, key, 0); auto left = conf.get(section, key + "-left", value);