When opening a chat holding unread messages, it scrolls to the first one

This commit is contained in:
DieGurke 2020-07-11 14:57:15 +02:00
parent 0cebaeacb5
commit 0b0b240fb1
1 changed files with 1 additions and 1 deletions

View File

@ -232,7 +232,7 @@ public final class ChatScene implements Restorable {
currentChat = localDB.getChat(user.getID()).get();
messageList.setItems(FXCollections.observableList(currentChat.getMessages()));
final var scrollIndex = messageList.getItems().size() - 1;
final var scrollIndex = messageList.getItems().size() - currentChat.getUnreadAmount() - 1;
messageList.scrollTo(scrollIndex);
logger.log(Level.FINEST, "Loading chat with " + user + " at index " + scrollIndex);
deleteContactMenuItem.setText("Delete " + user.getName());