diff --git a/imports/Spectral/Panel/RoomPanel.qml b/imports/Spectral/Panel/RoomPanel.qml index d0b276c..0ecac76 100644 --- a/imports/Spectral/Panel/RoomPanel.qml +++ b/imports/Spectral/Panel/RoomPanel.qml @@ -1,16 +1,15 @@ import QtQuick 2.9 RoomPanelForm { - roomHeader.onClicked: roomDrawer.open() roomHeader.image: spectralController.safeImage(currentRoom ? currentRoom.avatar : null) roomHeader.topic: currentRoom ? (currentRoom.topic).replace(/(\r\n\t|\n|\r\t)/gm,"") : "" + roomHeader.onClicked: roomDrawer.open() sortedMessageEventModel.onModelReset: { if (currentRoom) { var lastScrollPosition = sortedMessageEventModel.mapFromSource(currentRoom.savedTopVisibleIndex()) - console.log("Scrolling to position", lastScrollPosition) messageListView.currentIndex = lastScrollPosition - if (messageListView.contentY < messageListView.originY + 10 || messageListView.contentHeight < messageListView.height || currentRoom.timelineSize === 0) + if (messageListView.contentY < messageListView.originY + 10 || currentRoom.timelineSize < 20) currentRoom.getPreviousContent(100) } } diff --git a/imports/Spectral/Panel/RoomPanelInput.qml b/imports/Spectral/Panel/RoomPanelInput.qml index 23380dd..43fd239 100644 --- a/imports/Spectral/Panel/RoomPanelInput.qml +++ b/imports/Spectral/Panel/RoomPanelInput.qml @@ -51,6 +51,7 @@ Rectangle { clip: true orientation: ListView.Horizontal highlightFollowsCurrentItem: true + keyNavigationWraps: true highlight: Rectangle { color: Material.accent @@ -205,17 +206,11 @@ Rectangle { } } - Keys.onBacktabPressed: { - if (isAutoCompleting) { - if (autoCompleteListView.currentIndex == 0) autoCompleteListView.currentIndex = autoCompleteListView.count - 1 - else autoCompleteListView.currentIndex-- - } - } + Keys.onBacktabPressed: if (isAutoCompleting) autoCompleteListView.decrementCurrentIndex() Keys.onTabPressed: { if (isAutoCompleting) { - if (autoCompleteListView.currentIndex + 1 == autoCompleteListView.count) autoCompleteListView.currentIndex = 0 - else autoCompleteListView.currentIndex++ + autoCompleteListView.incrementCurrentIndex() } else { autoCompleteBeginPosition = text.substring(0, cursorPosition).lastIndexOf(" ") + 1 var autoCompletePrefix = text.substring(0, cursorPosition).split(" ").pop()