diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2021-07-06 23:03:13 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2021-07-06 23:03:13 (GMT) |
commit | dd238f9d95113831daec1f8750ca60abac0e4a01 (patch) | |
tree | 9052cf06e317f96a8df5d47833b7193cf2499815 /src/FbTk | |
parent | b0663bc167f34b9796f98406329317f7bee15b00 (diff) | |
download | fluxbox-dd238f9d95113831daec1f8750ca60abac0e4a01.zip fluxbox-dd238f9d95113831daec1f8750ca60abac0e4a01.tar.bz2 |
Patch from Bo Simonsen.
Improve switching between 12H and 24H in Clock Tool
configuration
Having:
session.screen0.strftimeFormat: %d-%m-%y %02k:%M
The switch[1] between 12H and 24H did not work due to the digits (02).
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/StringUtil.cc | 9 | ||||
-rw-r--r-- | src/FbTk/StringUtil.hh | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc index 63da383..b5f373f 100644 --- a/src/FbTk/StringUtil.cc +++ b/src/FbTk/StringUtil.cc | |||
@@ -274,9 +274,16 @@ string findExtension(const string &filename) { | |||
274 | return filename.substr(start_pos + 1); | 274 | return filename.substr(start_pos + 1); |
275 | } | 275 | } |
276 | 276 | ||
277 | string::size_type findCharFromAlphabetAfterTrigger(const std::string& in, char trigger, const char alphabet[], size_t len_alphabet, size_t* found) { | 277 | string::size_type findCharFromAlphabetAfterTrigger(const std::string& in, char trigger, const char alphabet[], size_t len_alphabet, size_t* found, const char ignore_after_trigger[], size_t len_ignore_after_trigger) { |
278 | for (const char* s = in.c_str(); *s != '\0'; ) { | 278 | for (const char* s = in.c_str(); *s != '\0'; ) { |
279 | if (*s++ == trigger && *s != '\0') { | 279 | if (*s++ == trigger && *s != '\0') { |
280 | auto end = ignore_after_trigger + len_ignore_after_trigger; | ||
281 | while (std::find(ignore_after_trigger, end, *s) != end) | ||
282 | s++; | ||
283 | |||
284 | if (*s == '\0') | ||
285 | return string::npos; | ||
286 | |||
280 | for (const char* a = alphabet; (a - alphabet) < static_cast<ssize_t>(len_alphabet); ++a) { | 287 | for (const char* a = alphabet; (a - alphabet) < static_cast<ssize_t>(len_alphabet); ++a) { |
281 | if (*s == *a) { | 288 | if (*s == *a) { |
282 | if (found) { | 289 | if (found) { |
diff --git a/src/FbTk/StringUtil.hh b/src/FbTk/StringUtil.hh index bfa3a5c..5e0d0d4 100644 --- a/src/FbTk/StringUtil.hh +++ b/src/FbTk/StringUtil.hh | |||
@@ -69,7 +69,7 @@ std::string findExtension(const std::string &filename); | |||
69 | /// @return std::string::npos if nothing found | 69 | /// @return std::string::npos if nothing found |
70 | std::string::size_type findCharFromAlphabetAfterTrigger(const std::string& in, | 70 | std::string::size_type findCharFromAlphabetAfterTrigger(const std::string& in, |
71 | char trigger, | 71 | char trigger, |
72 | const char alphabet[], size_t len_alphabet, size_t* found); | 72 | const char alphabet[], size_t len_alphabet, size_t* found, const char ignore_after_trigger[] = "", size_t len_ignore_after_trigger = 0); |
73 | 73 | ||
74 | /// @return copy of original with find_string replaced with "replace" | 74 | /// @return copy of original with find_string replaced with "replace" |
75 | std::string replaceString(const std::string &original, | 75 | std::string replaceString(const std::string &original, |