List rows are single-line, but script-supplied strings can carry newlines (3DS SMDH long titles store the two-line marquee form as "line1\nline2"). C2D_DrawText honours those breaks and wraps the row mid-screen, so collapse any CR/LF run to a single space before the row is measured and drawn.
| 50 | // C2D_DrawText honours those breaks and wraps the row mid-screen, so collapse |
| 51 | // any CR/LF run to a single space before the row is measured and drawn. |
| 52 | std::string flattenLine(const std::string& s) |
| 53 | { |
| 54 | std::string out; |
| 55 | out.reserve(s.size()); |
| 56 | bool pendingSpace = false; |
| 57 | for (char c : s) { |
| 58 | if (c == '\n' || c == '\r') { |
| 59 | pendingSpace = !out.empty(); |
| 60 | continue; |
| 61 | } |
| 62 | if (pendingSpace) { |
| 63 | out.push_back(' '); |
| 64 | pendingSpace = false; |
| 65 | } |
| 66 | out.push_back(c); |
| 67 | } |
| 68 | return out; |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | /* ---- shared tile chrome ------------------------------------------------- */ |