A fork of https://github.com/crosspoint-reader/crosspoint-reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: show long branch names (#1727)

## Summary

* This change will make better use of the space available for Title and
Subtitle in the Settings (Theme: Lyra).
Instead of having a fixed maxwidth in pixels for subtitle, it will use
the whole line and shorten the longest one if needed.

So instead of: <img width="480" height="140" alt="image"
src="https://github.com/user-attachments/assets/67e4777b-10d0-4a05-b5c7-fb775776c186"
/>

It will now show: <img width="480" height="142" alt="image"
src="https://github.com/user-attachments/assets/2f143f4e-75d7-45c4-b61a-aad56bdf39fb"
/>


---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**NO**_

authored by

Stefan Blixten Karlsson and committed by
GitHub
56d3ab92 9dab5f47

+21 -3
+21 -3
src/components/themes/lyra/LyraTheme.cpp
··· 35 35 constexpr int topHintButtonY = 345; 36 36 constexpr int popupMarginX = 16; 37 37 constexpr int popupMarginY = 12; 38 - constexpr int maxSubtitleWidth = 100; 39 38 constexpr int maxListValueWidth = 200; 40 39 constexpr int mainMenuIconSize = 32; 41 40 constexpr int listIconSize = 24; ··· 150 149 Rect{batteryX, rect.y + 5, LyraMetrics::values.batteryWidth, LyraMetrics::values.batteryHeight}, 151 150 showBatteryPercentage); 152 151 153 - int maxTitleWidth = 154 - rect.width - LyraMetrics::values.contentSidePadding * 2 - (subtitle != nullptr ? maxSubtitleWidth : 0); 152 + int maxTitleWidth = title != nullptr ? renderer.getTextWidth(UI_12_FONT_ID, title, EpdFontFamily::BOLD) : 0; 153 + int maxSubtitleWidth = 154 + subtitle != nullptr ? renderer.getTextWidth(SMALL_FONT_ID, subtitle, EpdFontFamily::REGULAR) : 0; 155 + 156 + // Available space is the distance between the side paddings, and a with side padding between title and subtitle. 157 + const int availableSpace = rect.width - LyraMetrics::values.contentSidePadding * 3; 158 + 159 + if (maxTitleWidth + maxSubtitleWidth > availableSpace) { 160 + if ((maxTitleWidth > availableSpace / 2) && (maxSubtitleWidth > availableSpace / 2)) { 161 + // Both are wider then half the space, truncate both. 162 + maxTitleWidth = availableSpace / 2; 163 + maxSubtitleWidth = availableSpace / 2; 164 + } else { 165 + // Truncate the the longest one 166 + if (maxTitleWidth > maxSubtitleWidth) { 167 + maxTitleWidth = availableSpace - maxSubtitleWidth; 168 + } else { 169 + maxSubtitleWidth = availableSpace - maxTitleWidth; 170 + } 171 + } 172 + } 155 173 156 174 if (title) { 157 175 auto truncatedTitle = renderer.truncatedText(UI_12_FONT_ID, title, maxTitleWidth, EpdFontFamily::BOLD);