Add tab-completion for usernames

fixes #394
This commit is contained in:
Konstantinos Sideris 2018-07-29 21:58:18 +03:00
parent edf9f5242a
commit 6ffb747421
2 changed files with 49 additions and 11 deletions

View file

@ -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()
{