summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Batischev <eual.jp@gmail.com>2021-05-02 20:25:33 +0300
committerAlexander Batischev <eual.jp@gmail.com>2021-05-17 15:23:14 +0300
commitaf93520a8c5de4c9331349b8143e09c89d160d85 (patch)
treec74b45da887971138fae6902663c7239f0da226b
parent80a3cdcb511c6b5b240427b59a77c8ed9512aa0c (diff)
Switch SelectFormAction's storage to Utf8String
-rw-r--r--include/selectformaction.h22
-rw-r--r--src/selectformaction.cpp2
2 files changed, 17 insertions, 7 deletions
diff --git a/include/selectformaction.h b/include/selectformaction.h
index e0f1b7cb..8a7c5e2f 100644
--- a/include/selectformaction.h
+++ b/include/selectformaction.h
@@ -4,6 +4,7 @@
#include "filtercontainer.h"
#include "formaction.h"
#include "listwidget.h"
+#include "utf8string.h"
namespace newsboat {
@@ -18,15 +19,24 @@ public:
KeyMapHintEntry* get_keymap_hint() override;
std::string get_selected_value()
{
- return value;
+ return value.to_utf8();
}
void set_tags(const std::vector<std::string>& t)
{
- tags = t;
+ tags.clear();
+ for (const auto& tag : t) {
+ tags.push_back(Utf8String::from_utf8(tag));
+ }
}
void set_filters(const std::vector<FilterNameExprPair>& ff)
{
- filters = ff;
+ filters.clear();
+ for (const auto& filter : ff) {
+ InternalFilterNameExprPair entry;
+ entry.name = Utf8String::from_utf8(filter.name);
+ entry.expr = Utf8String::from_utf8(filter.expr);
+ filters.push_back(entry);
+ }
}
void set_type(SelectionType t)
{
@@ -46,9 +56,9 @@ private:
std::vector<std::string>* args = nullptr) override;
bool quit;
SelectionType type;
- std::string value;
- std::vector<std::string> tags;
- std::vector<FilterNameExprPair> filters;
+ Utf8String value;
+ std::vector<Utf8String> tags;
+ std::vector<InternalFilterNameExprPair> filters;
std::string format_line(const std::string& selecttag_format,
const std::string& tag,
diff --git a/src/selectformaction.cpp b/src/selectformaction.cpp
index 06b9fd9f..34d522c5 100644
--- a/src/selectformaction.cpp
+++ b/src/selectformaction.cpp
@@ -161,7 +161,7 @@ void SelectFormAction::prepare()
listfmt.add_line(
utils::quote_for_stfl(
format_line(selecttag_format,
- tag,
+ tag.to_utf8(),
i + 1,
width)));
i++;