diff options
author | Alexander Batischev <eual.jp@gmail.com> | 2021-05-17 15:20:07 +0300 |
---|---|---|
committer | Alexander Batischev <eual.jp@gmail.com> | 2021-05-17 15:23:15 +0300 |
commit | db06d9be947264a4c23b7266952634e43f136970 (patch) | |
tree | b976c0732aeed9aa7419cd58dd78ad748dbeeb31 | |
parent | aff3f9bb87bd2b757a45af262b1c603b6562894c (diff) |
Switch TextViewWidget's storage to Utf8Stringminoru/feature/1344-utf8string
-rw-r--r-- | include/textviewwidget.h | 3 | ||||
-rw-r--r-- | mk/mk.deps | 9 | ||||
-rw-r--r-- | src/textviewwidget.cpp | 14 |
3 files changed, 13 insertions, 13 deletions
diff --git a/include/textviewwidget.h b/include/textviewwidget.h index d9d065dc..2672d3a3 100644 --- a/include/textviewwidget.h +++ b/include/textviewwidget.h @@ -6,6 +6,7 @@ #include <string> #include "stflpp.h" +#include "utf8string.h" namespace newsboat { @@ -29,7 +30,7 @@ public: std::uint32_t get_width(); std::uint32_t get_height(); private: - const std::string textview_name; + const Utf8String textview_name; Stfl::Form& form; std::uint32_t num_lines; }; @@ -844,11 +844,10 @@ src/textformatter.o: src/textformatter.cpp include/textformatter.h \ target/cxxbridge/libnewsboat-ffi/src/logger.rs.h \ target/cxxbridge/libnewsboat-ffi/src/utils.rs.h src/textviewwidget.o: src/textviewwidget.cpp include/textviewwidget.h \ - include/stflpp.h include/utils.h 3rd-party/expected.hpp \ - 3rd-party/optional.hpp include/configcontainer.h \ - include/configactionhandler.h include/utf8string.h include/logger.h \ - config.h include/strprintf.h \ - target/cxxbridge/libnewsboat-ffi/src/logger.rs.h \ + include/stflpp.h include/utf8string.h include/utils.h \ + 3rd-party/expected.hpp 3rd-party/optional.hpp include/configcontainer.h \ + include/configactionhandler.h include/logger.h config.h \ + include/strprintf.h target/cxxbridge/libnewsboat-ffi/src/logger.rs.h \ target/cxxbridge/libnewsboat-ffi/src/utils.rs.h src/ttrssapi.o: src/ttrssapi.cpp include/ttrssapi.h 3rd-party/json.hpp \ include/cache.h include/configcontainer.h include/configactionhandler.h \ diff --git a/src/textviewwidget.cpp b/src/textviewwidget.cpp index 12edf335..5a9740cb 100644 --- a/src/textviewwidget.cpp +++ b/src/textviewwidget.cpp @@ -8,7 +8,7 @@ namespace newsboat { TextviewWidget::TextviewWidget(const std::string& textview_name, Stfl::Form& form) - : textview_name(textview_name) + : textview_name(Utf8String::from_utf8(textview_name)) , form(form) , num_lines(0) { @@ -18,14 +18,14 @@ void TextviewWidget::stfl_replace_textview(std::uint32_t number_of_lines, std::string stfl) { num_lines = number_of_lines; - form.modify(textview_name, "replace", stfl); + form.modify(textview_name.to_utf8(), "replace", stfl); } void TextviewWidget::stfl_replace_lines(std::uint32_t number_of_lines, std::string stfl) { num_lines = number_of_lines; - form.modify(textview_name, "replace_inner", stfl); + form.modify(textview_name.to_utf8(), "replace_inner", stfl); } void TextviewWidget::scroll_up() @@ -94,7 +94,7 @@ void TextviewWidget::scroll_page_down() std::uint32_t TextviewWidget::get_scroll_offset() { - const std::string offset = form.get(textview_name + "_offset"); + const std::string offset = form.get((textview_name + "_offset").to_utf8()); if (!offset.empty()) { return std::max(0, std::stoi(offset)); } @@ -103,17 +103,17 @@ std::uint32_t TextviewWidget::get_scroll_offset() void TextviewWidget::set_scroll_offset(std::uint32_t offset) { - form.set(textview_name + "_offset", std::to_string(offset)); + form.set((textview_name + "_offset").to_utf8(), std::to_string(offset)); } std::uint32_t TextviewWidget::get_width() { - return utils::to_u(form.get(textview_name + ":w")); + return utils::to_u(form.get((textview_name + ":w").to_utf8())); } std::uint32_t TextviewWidget::get_height() { - return utils::to_u(form.get(textview_name + ":h")); + return utils::to_u(form.get((textview_name + ":h").to_utf8())); } } // namespace newsboat |