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:
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user