diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-07-29 21:58:18 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-07-29 21:58:18 +0300 |
commit | 6ffb747421de2a97cdeeb29961f0f8f1062ab834 (patch) | |
tree | 28b3de0a13807f7804e4fba23e547bd9cbf15ec9 /src/TextInputWidget.h | |
parent | v0.5.2 (diff) | |
download | nheko-6ffb747421de2a97cdeeb29961f0f8f1062ab834.tar.xz |
Add tab-completion for usernames
fixes #394
Diffstat (limited to 'src/TextInputWidget.h')
-rw-r--r-- | src/TextInputWidget.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/TextInputWidget.h b/src/TextInputWidget.h index e7d5f948..37d73fbb 100644 --- a/src/TextInputWidget.h +++ b/src/TextInputWidget.h @@ -94,8 +94,23 @@ private: SuggestionsPopup popup_; + enum class AnchorType + { + Tab = 0, + Sigil = 1, + }; + + AnchorType anchorType_ = AnchorType::Sigil; + + int anchorWidth(AnchorType anchor) { return static_cast<int>(anchor); } + void closeSuggestions() { popup_.hide(); } void resetAnchor() { atTriggerPosition_ = -1; } + bool isAnchorValid() { return atTriggerPosition_ != -1; } + bool hasAnchor(int pos, AnchorType anchor) + { + return pos == atTriggerPosition_ + anchorWidth(anchor); + } QString query() { |