Fix a few small completer glitches

This commit is contained in:
Nicolas Werner 2022-03-01 01:59:06 +01:00
parent a307dc46cb
commit 23efa8f815
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
4 changed files with 21 additions and 12 deletions

View file

@ -77,11 +77,11 @@ Control {
}
currentIndex = -1
}
padding: 0
leftInset: 1
bottomInset: 1
topInset: 1
rightInset: 1
bottomPadding: 1
leftPadding: 1
topPadding: 1
rightPadding: 1
contentItem: ListView {
id: listView
@ -107,7 +107,6 @@ Control {
onContentYChanged: deadTimer.restart()
reuseItems: true
//anchors.fill: parent
implicitWidth: listView.contentItem.childrenRect.width
model: completer
verticalLayoutDirection: popup.bottomToTop ? ListView.BottomToTop : ListView.TopToBottom
@ -120,7 +119,7 @@ Control {
color: model.index == popup.currentIndex ? Nheko.colors.highlight : Nheko.colors.base
height: chooser.child.implicitHeight + 2 * popup.rowMargin
implicitWidth: fullWidth ? popup.implicitContentWidth : chooser.child.implicitWidth + 4
implicitWidth: fullWidth ? ListView.view.width : chooser.child.implicitWidth + 4
MouseArea {
id: mouseArea

View file

@ -156,7 +156,7 @@ Rectangle {
onSelectionStartChanged: room.input.updateState(selectionStart, selectionEnd, cursorPosition, text)
onSelectionEndChanged: room.input.updateState(selectionStart, selectionEnd, cursorPosition, text)
// Ensure that we get escape key press events first.
Keys.onShortcutOverride: event.accepted = (popup.opened && (event.key === Qt.Key_Escape || event.key === Qt.Key_Tab || event.key === Qt.Key_Enter))
Keys.onShortcutOverride: event.accepted = (popup.opened && (event.key === Qt.Key_Escape || event.key === Qt.Key_Tab || event.key === Qt.Key_Enter || event.key === Qt.Key_Space))
Keys.onPressed: {
if (event.matches(StandardKey.Paste)) {
room.input.paste(false);
@ -166,7 +166,7 @@ Rectangle {
if (cursorPosition == completerTriggeredAt + 1)
popup.close();
if (popup.opened && popup.count <= 0)
if (popup.opened && completer.count <= 0)
popup.close();
} else if (event.modifiers == Qt.ControlModifier && event.key == Qt.Key_U) {
@ -190,6 +190,8 @@ Rectangle {
} else if (event.matches(StandardKey.SelectAll) && popup.opened) {
completer.completerName = "";
popup.close();
} else if (event.matches(StandardKey.InsertLineSeparator)) {
if (popup.opened) popup.close();
} else if (event.matches(StandardKey.InsertParagraphSeparator)) {
if (popup.opened) {
var currentCompletion = completer.currentCompletion();
@ -304,12 +306,15 @@ Rectangle {
x: messageInput.positionToRectangle(messageInput.completerTriggeredAt).x
y: messageInput.positionToRectangle(messageInput.completerTriggeredAt).y - height
padding: 0
background: null
padding: 0
Completer {
anchors.fill: parent
id: completer
rowMargin: 2
rowSpacing: 0
}
enter: Transition {

View file

@ -24,6 +24,7 @@ Popup {
onOpened: {
roomTextInput.forceActiveFocus();
}
property int textMargin: Nheko.paddingSmall
Column{
anchors.fill: parent

View file

@ -173,7 +173,7 @@ Pane {
onActivated: {
var quickSwitch = quickSwitcherComponent.createObject(timelineRoot);
quickSwitch.open();
destroyOnClose(quickSwitch);
destroyOnClosed(quickSwitch);
}
}
@ -225,6 +225,10 @@ Pane {
obj.closing.connect(() => obj.destroy());
}
function destroyOnClosed(obj) {
obj.closed.connect(() => obj.destroy());
}
Connections {
function onOpenProfile(profile) {
var userProfile = userProfileComponent.createObject(timelineRoot, {