File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed
src/plugins/codegeex/widgets Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -144,14 +144,22 @@ void InputEditWidgetPrivate::initEdit()
144
144
if (cursorPos > 0 && edit->document ()->characterAt (cursorPos - 1 ) == " @" )
145
145
q->popupReference ();
146
146
147
- if (referencePopup->isVisible () && !currentText.endsWith (' @' )) {
147
+ if (!currentText.contains (' @' )) {
148
+ referencePopup->hide ();
149
+ } else if (!currentText.endsWith (' @' )) {
148
150
auto start = currentText.indexOf (' @' );
149
151
auto firstSpace = currentText.indexOf (' ' , start); // first space after `@`
150
- if (start == -1 || (firstSpace != -1 && cursorPos > firstSpace))
152
+ if (start == -1 || (firstSpace != -1 && cursorPos > firstSpace)) {
151
153
referencePopup->hide ();
154
+ return ;
155
+ }
152
156
153
157
auto filterText = currentText.mid (start + 1 , cursorPos - start - 1 );
154
158
model.setFilterText (filterText);
159
+ if (model.getItems ().isEmpty ())
160
+ referencePopup->hide ();
161
+ else
162
+ referencePopup->show ();
155
163
} else {
156
164
model.setFilterText (" " );
157
165
}
@@ -394,6 +402,7 @@ bool InputEditWidget::eventFilter(QObject *watched, QEvent *event)
394
402
emit handleKey (keyEvent);
395
403
return true ;
396
404
case Qt::Key_Space:
405
+ case Qt::Key_Escape:
397
406
d->referencePopup ->hide ();
398
407
break ;
399
408
default :
Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ void ItemModel::setFilterText(const QString &filterText)
169
169
beginResetModel ();
170
170
displayItems.clear ();
171
171
for (auto item : items) {
172
- if (item.displayName .startsWith (filterText))
172
+ if (item.displayName .startsWith (filterText, Qt::CaseInsensitive) || item. type . startsWith (filterText, Qt::CaseInsensitive ))
173
173
displayItems.append (item);
174
174
}
175
175
endResetModel ();
Original file line number Diff line number Diff line change @@ -46,9 +46,9 @@ class DisplayItemDelegate : public DStyledItemDelegate
46
46
47
47
struct ItemInfo
48
48
{
49
- QString type;
50
- QString displayName;
51
- QString extraInfo;
49
+ QString type { " " } ;
50
+ QString displayName { " " } ;
51
+ QString extraInfo { " " } ;
52
52
QIcon icon;
53
53
};
54
54
You can’t perform that action at this time.
0 commit comments