Keep the ellipsis in RTL month chips (#164)

softWrap=false makes Compose lay the line out at its full width and clip
to the node's left edge, so an RTL title lost its beginning instead of its
end. RTL keeps the old ellipsis, which truncates at the logical end.
This commit is contained in:
2026-08-13 14:29:35 +02:00
parent a481ddbd10
commit 236abc9bb1

View File

@@ -2352,6 +2352,11 @@ private fun MonthBar(
}, },
contentAlignment = Alignment.CenterStart, contentAlignment = Alignment.CenterStart,
) { ) {
// Clipping only keeps the start of the title in an LTR layout: with
// softWrap off Compose lays the line out at its full width and clips to
// the chip's *left* edge, which in RTL is the end of the string. So RTL
// keeps the ellipsis, which truncates at the logical end either way.
val rtl = LocalLayoutDirection.current == LayoutDirection.Rtl
Text( Text(
text = title, text = title,
style = MaterialTheme.typography.labelSmall, style = MaterialTheme.typography.labelSmall,
@@ -2360,8 +2365,8 @@ private fun MonthBar(
// couple of readable characters. softWrap is off with it — left on, // couple of readable characters. softWrap is off with it — left on,
// a clipped line breaks at the last whole word instead of running to // a clipped line breaks at the last whole word instead of running to
// the chip's edge, which reads as *less* title, not more. // the chip's edge, which reads as *less* title, not more.
overflow = TextOverflow.Clip, overflow = if (rtl) TextOverflow.Ellipsis else TextOverflow.Clip,
softWrap = false, softWrap = rtl,
color = eventInk(fill), color = eventInk(fill),
) )
} }