mirror of https://github.com/procxx/kepka.git
Fix field autocomplete in empty chat.
This commit is contained in:
parent
35c759c6bc
commit
44c6050bf2
|
@ -57,7 +57,10 @@ void FieldAutocomplete::paintEvent(QPaintEvent *e) {
|
||||||
p.fillRect(rect(), st::mentionBg);
|
p.fillRect(rect(), st::mentionBg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FieldAutocomplete::showFiltered(PeerData *peer, QString query, bool addInlineBots) {
|
void FieldAutocomplete::showFiltered(
|
||||||
|
not_null<PeerData*> peer,
|
||||||
|
QString query,
|
||||||
|
bool addInlineBots) {
|
||||||
_chat = peer->asChat();
|
_chat = peer->asChat();
|
||||||
_user = peer->asUser();
|
_user = peer->asUser();
|
||||||
_channel = peer->asChannel();
|
_channel = peer->asChannel();
|
||||||
|
@ -105,9 +108,9 @@ void FieldAutocomplete::showStickers(EmojiPtr emoji) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_chat = 0;
|
_chat = nullptr;
|
||||||
_user = 0;
|
_user = nullptr;
|
||||||
_channel = 0;
|
_channel = nullptr;
|
||||||
|
|
||||||
updateFiltered(resetScroll);
|
updateFiltered(resetScroll);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,10 @@ public:
|
||||||
FieldAutocomplete(QWidget *parent);
|
FieldAutocomplete(QWidget *parent);
|
||||||
|
|
||||||
bool clearFilteredBotCommands();
|
bool clearFilteredBotCommands();
|
||||||
void showFiltered(PeerData *peer, QString query, bool addInlineBots);
|
void showFiltered(
|
||||||
|
not_null<PeerData*> peer,
|
||||||
|
QString query,
|
||||||
|
bool addInlineBots);
|
||||||
void showStickers(EmojiPtr emoji);
|
void showStickers(EmojiPtr emoji);
|
||||||
void setBoundings(QRect boundings);
|
void setBoundings(QRect boundings);
|
||||||
|
|
||||||
|
|
|
@ -1034,6 +1034,9 @@ void HistoryWidget::onHashtagOrBotCommandInsert(
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::updateInlineBotQuery() {
|
void HistoryWidget::updateInlineBotQuery() {
|
||||||
|
if (!_history) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const auto query = ParseInlineBotQuery(_field);
|
const auto query = ParseInlineBotQuery(_field);
|
||||||
if (_inlineBotUsername != query.username) {
|
if (_inlineBotUsername != query.username) {
|
||||||
_inlineBotUsername = query.username;
|
_inlineBotUsername = query.username;
|
||||||
|
@ -1131,20 +1134,22 @@ void HistoryWidget::setReportSpamStatus(DBIPeerReportSpamStatus status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::updateStickersByEmoji() {
|
void HistoryWidget::updateStickersByEmoji() {
|
||||||
int len = 0;
|
if (!_history) {
|
||||||
if (!_editMsgId) {
|
return;
|
||||||
auto &text = _field->getTextWithTags().text;
|
}
|
||||||
if (auto emoji = Ui::Emoji::Find(text, &len)) {
|
const auto emoji = [&] {
|
||||||
if (text.size() > len) {
|
if (!_editMsgId) {
|
||||||
len = 0;
|
const auto &text = _field->getTextWithTags().text;
|
||||||
} else {
|
auto length = 0;
|
||||||
_fieldAutocomplete->showStickers(emoji);
|
if (const auto emoji = Ui::Emoji::Find(text, &length)) {
|
||||||
|
if (text.size() <= length) {
|
||||||
|
return emoji;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return EmojiPtr(nullptr);
|
||||||
if (!len) {
|
}();
|
||||||
_fieldAutocomplete->showStickers(nullptr);
|
_fieldAutocomplete->showStickers(emoji);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::onTextChange() {
|
void HistoryWidget::onTextChange() {
|
||||||
|
|
Loading…
Reference in New Issue