Keep every line of a multi-line message in chat history

The text log has a message's line breaks in it, but history was read one
line at a time, so every line after the first failed to parse and was
dropped. A line that starts no entry of its own now continues the
message before it, which also recovers what earlier versions wrote.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 10:50:12 +00:00
parent 8e9c461424
commit f9b2f4d7cb
2 changed files with 42 additions and 11 deletions

View File

@@ -68,4 +68,16 @@ class ChatLogStoreTest {
assertTrue(capped.truncated());
assertTrue(capped.entries().get(9).contains("filler " + (ChatLogStore.HISTORY_LIMIT - 1)));
}
@Test
void readsAMessageWithLineBreaksBackWhole() throws Exception {
ChatLogStore logs = new ChatLogStore(temp, "+Tyg2JtxE8vRNZp+JiUBnmBh0MY=");
logs.appendMessage(ChatLogScope.CHANNEL, false, 5, "uid", "alice", "first line\n\nthird line");
logs.appendMessage(ChatLogScope.CHANNEL, false, 5, "uid", "bob", "reply");
List<String> history = logs.channelHtmlHistory();
assertEquals(2, history.size());
assertTrue(history.get(0).contains("first line<br><br>third line"), history.get(0));
assertTrue(history.get(1).contains("reply"));
}
}