2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 00:55:12 +00:00

Display occupied chats using drafts for support.

This commit is contained in:
John Preston
2018-11-15 19:36:04 +04:00
parent 60103f7ad6
commit 4960e08a24
20 changed files with 429 additions and 95 deletions

View File

@@ -328,11 +328,11 @@ Autocomplete::Autocomplete(QWidget *parent, not_null<AuthSession*> session)
}
void Autocomplete::activate(not_null<Ui::InputField*> field) {
if (Auth().settings().supportTemplatesAutocomplete()) {
if (_session->settings().supportTemplatesAutocomplete()) {
_activate();
} else {
const auto templates = Auth().supportTemplates();
const auto max = templates->maxKeyLength();
const auto &templates = _session->supportTemplates();
const auto max = templates.maxKeyLength();
auto cursor = field->textCursor();
const auto position = cursor.position();
const auto anchor = cursor.anchor();
@@ -344,8 +344,8 @@ void Autocomplete::activate(not_null<Ui::InputField*> field) {
std::max(position - max, 0),
position);
const auto result = (position != anchor)
? templates->matchExact(text.text)
: templates->matchFromEnd(text.text);
? templates.matchExact(text.text)
: templates.matchFromEnd(text.text);
if (result) {
const auto till = std::max(position, anchor);
const auto from = till - result->key.size();
@@ -410,7 +410,7 @@ void Autocomplete::setupContent() {
const auto refresh = [=] {
inner->showRows(
_session->supportTemplates()->query(input->getLastText()));
_session->supportTemplates().query(input->getLastText()));
scroll->scrollToY(0);
};