| 134 | } |
| 135 | |
| 136 | std::string shorten_text(std::string text, size_t limit) { |
| 137 | if (text.size() <= limit) { |
| 138 | return text; |
| 139 | } |
| 140 | size_t cut = text.rfind(' ', limit); |
| 141 | if (cut == std::string::npos || cut < (limit / 2)) { |
| 142 | cut = limit; |
| 143 | } |
| 144 | text.resize(cut); |
| 145 | while (!text.empty() && std::isspace(static_cast<unsigned char>(text.back())) != 0) { |
| 146 | text.pop_back(); |
| 147 | } |
| 148 | return text; |
| 149 | } |
| 150 | |
| 151 | std::filesystem::path write_clipped_wav( |
| 152 | const std::filesystem::path & source_path, |
no test coverage detected