Skip to content

Commit d4eed93

Browse files
loganjLarryclaude
committed
fix(mobile): keep the edited marker when an earlier part has a slot
When an authored U+E0ED was in an earlier part of a message, before an attachment, the marker component was off for the whole message, but the last part still got a slot. That slot drew as a plain character and the edited marker disappeared. The last part now uses the same decision, so the marker takes its own line. Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Logan Johnson <[email protected]>
1 parent 82746fe commit d4eed93

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

‎mobile/lib/features/channels/message_content.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ class MessageContent extends HookConsumerWidget {
483483
? segments.isNotEmpty && !segments.last.attachment
484484
: finalContent.trim().isNotEmpty);
485485
Widget renderBody(String text, {required bool last}) => editedInBody && last
486-
? markedEditedBody(text, renderMarkdown, editedStyle)
486+
? markedEditedBody(text, renderMarkdown, editedStyle, slot: markerSlot)
487487
: renderMarkdown(text);
488488
final markdown = bubble
489489
? Column(

‎mobile/lib/features/channels/message_content/edited_marker.dart‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,16 @@ TextStyle editedMarkerStyle(BuildContext context, {required bool own}) =>
8181
);
8282

8383
/// [markdown] drawn by [render] with the edited marker after its last line:
84-
/// joined to prose, else on its own line inside the same text bubble.
84+
/// joined to prose, else on its own line inside the same text bubble. [slot]
85+
/// says whether the message's renderer draws [editedSlot] as the marker; it
86+
/// does not when any part of the message has an authored slot.
8587
Widget markedEditedBody(
8688
String markdown,
8789
Widget Function(String) render,
88-
TextStyle style,
89-
) {
90-
final slotted = withEditedSlot(markdown);
90+
TextStyle style, {
91+
required bool slot,
92+
}) {
93+
final slotted = slot ? withEditedSlot(markdown) : null;
9194
if (slotted != null) return render(slotted);
9295
return Column(
9396
crossAxisAlignment: CrossAxisAlignment.start,

‎mobile/test/features/channels/message_content_bubble_cases.dart‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,5 +436,9 @@ void editedMarkerTests() {
436436
await show('Sneaky $editedSlot');
437437
expect(shows('Sneaky $editedSlot'), isTrue);
438438
expect(find.text('(edited)'), findsOneWidget);
439+
// Also when the authored slot is in an earlier part of the message.
440+
await show('Sneaky $editedSlot\n![](https://example.com/a.png)\nafter');
441+
expect(shows('Sneaky $editedSlot'), isTrue);
442+
expect(find.text('(edited)'), findsOneWidget);
439443
});
440444
}

0 commit comments

Comments
 (0)