diff options
author | Alexander Blair <snipa@jagtech.io> | 2020-02-28 19:54:37 -0800 |
---|---|---|
committer | Alexander Blair <snipa@jagtech.io> | 2020-02-28 19:54:37 -0800 |
commit | 8c2939a7cb1e2c05b2eee8e06df997b8b21e7ba8 (patch) | |
tree | 5a10e45ca0bc2fe33e1d51f46e264ef2ccf26241 | |
parent | Merge pull request #6259 (diff) | |
parent | simplewallet: point to "set help" in the lock screen message (diff) | |
download | monero-8c2939a7cb1e2c05b2eee8e06df997b8b21e7ba8.tar.xz |
Merge pull request #6058
88b82bef simplewallet: point to "set help" in the lock screen message (moneromooo-monero)
f19c9f23 util: allow newlines in string to be split (moneromooo-monero)
-rw-r--r-- | src/common/util.cpp | 15 | ||||
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/common/util.cpp b/src/common/util.cpp index 57e747837..747235646 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -1239,7 +1239,7 @@ std::string get_nix_version_display_string() return get_string_prefix_by_width(s, 999999999).second; }; - std::vector<std::pair<std::string, size_t>> split_string_by_width(const std::string &s, size_t columns) + std::vector<std::pair<std::string, size_t>> split_line_by_width(const std::string &s, size_t columns) { std::vector<std::string> words; std::vector<std::pair<std::string, size_t>> lines; @@ -1279,4 +1279,17 @@ std::string get_nix_version_display_string() return lines; } + std::vector<std::pair<std::string, size_t>> split_string_by_width(const std::string &s, size_t columns) + { + std::vector<std::string> lines; + std::vector<std::pair<std::string, size_t>> all_lines; + boost::split(lines, s, boost::is_any_of("\n"), boost::token_compress_on); + for (const auto &e: lines) + { + std::vector<std::pair<std::string, size_t>> new_lines = split_line_by_width(e, columns); + for (auto &l: new_lines) + all_lines.push_back(std::move(l)); + } + return all_lines; + } } diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index ef739b6fb..1a319c7c4 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -6218,7 +6218,7 @@ void simple_wallet::check_for_inactivity_lock(bool user) m_in_command = true; if (!user) { - const std::string speech = tr("I locked your Monero wallet to protect you while you were away"); + const std::string speech = tr("I locked your Monero wallet to protect you while you were away\nsee \"help_advanced set\" to configure/disable"); std::vector<std::pair<std::string, size_t>> lines = tools::split_string_by_width(speech, 45); size_t max_len = 0; |