summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-04-06 00:56:24 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2021-04-06 00:56:24 -0400
commit27e6bca65e8991ec1525dafd9ac966ae614bc003 (patch)
treeca185b0a672899152457542477fd93f73b92e451 /components
parent6acd65fbaa052abaa989201dd853ffa261d2231e (diff)
downloadabaddon-portaudio-27e6bca65e8991ec1525dafd9ac966ae614bc003.tar.gz
abaddon-portaudio-27e6bca65e8991ec1525dafd9ac966ae614bc003.zip
allow usage of multiple emoji shortcodes
also raise max completer entries
Diffstat (limited to 'components')
-rw-r--r--components/completer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/completer.cpp b/components/completer.cpp
index e37e11e..f32bbd5 100644
--- a/components/completer.cpp
+++ b/components/completer.cpp
@@ -1,9 +1,10 @@
+#include <unordered_set>
#include "completer.hpp"
#include "../abaddon.hpp"
#include "../util.hpp"
constexpr const int CompleterHeight = 150;
-constexpr const int MaxCompleterEntries = 15;
+constexpr const int MaxCompleterEntries = 30;
Completer::Completer() {
set_reveal_child(false);
@@ -204,13 +205,16 @@ done:
// if <15 guild emojis match then load up stock
if (i < 15) {
+ std::unordered_set<std::string> added_patterns;
auto &emojis = Abaddon::Get().GetEmojis();
const auto &shortcodes = emojis.GetShortCodes();
for (const auto &[shortcode, pattern] : shortcodes) {
+ if (added_patterns.find(pattern) != added_patterns.end()) continue;
if (!StringContainsCaseless(shortcode, term)) continue;
if (i++ > 15) break;
const auto &pb = emojis.GetPixBuf(pattern);
if (!pb) continue;
+ added_patterns.insert(pattern);
const auto entry = make_entry(shortcode, pattern);
entry->SetImage(pb->scale_simple(CompleterImageSize, CompleterImageSize, Gdk::INTERP_BILINEAR));
}