mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
Fix a few small completer glitches
This commit is contained in:
parent
a307dc46cb
commit
23efa8f815
4 changed files with 21 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
@ -198,7 +200,7 @@ Rectangle {
|
|||
if (currentCompletion) {
|
||||
messageInput.insertCompletion(currentCompletion);
|
||||
event.accepted = true;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
}
|
||||
room.input.send();
|
||||
|
@ -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 {
|
||||
|
|
|
@ -24,6 +24,7 @@ Popup {
|
|||
onOpened: {
|
||||
roomTextInput.forceActiveFocus();
|
||||
}
|
||||
property int textMargin: Nheko.paddingSmall
|
||||
|
||||
Column{
|
||||
anchors.fill: parent
|
||||
|
|
|
@ -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, {
|
||||
|
|
Loading…
Reference in a new issue