diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb4bf6ae..a21f639de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ - Dev: Refactor `Image` & Image's `Frames`. (#4773) - Dev: Add `WindowManager::getLastSelectedWindow()` to replace `getMainWindow()`. (#4816) - Dev: Clarify signal connection lifetimes where applicable. (#4818) -- Dev: Laid the groundwork for advanced input completion strategies. (#4639, #4846) +- Dev: Laid the groundwork for advanced input completion strategies. (#4639, #4846, #4853) - Dev: Fixed flickering when running with Direct2D on Windows. (#4851) ## 2.4.6 diff --git a/src/controllers/completion/TabCompletionModel.cpp b/src/controllers/completion/TabCompletionModel.cpp index 3d8afd36e..a56ea1a59 100644 --- a/src/controllers/completion/TabCompletionModel.cpp +++ b/src/controllers/completion/TabCompletionModel.cpp @@ -100,7 +100,7 @@ std::unique_ptr TabCompletionModel::buildSource( return this->buildEmoteSource(); } case SourceKind::User: { - return this->buildUserSource(); + return this->buildUserSource(true); // Completing with @ } case SourceKind::Command: { return this->buildCommandSource(); @@ -116,7 +116,8 @@ std::unique_ptr TabCompletionModel::buildSource( case SourceKind::EmoteUserCommand: { std::vector> sources; sources.push_back(this->buildEmoteSource()); - sources.push_back(this->buildUserSource()); + sources.push_back( + this->buildUserSource(false)); // Not completing with @ sources.push_back(this->buildCommandSource()); return std::make_unique( @@ -134,10 +135,12 @@ std::unique_ptr TabCompletionModel::buildEmoteSource() const std::make_unique()); } -std::unique_ptr TabCompletionModel::buildUserSource() const +std::unique_ptr TabCompletionModel::buildUserSource( + bool prependAt) const { return std::make_unique( - &this->channel_, std::make_unique()); + &this->channel_, std::make_unique(), + nullptr, prependAt); } std::unique_ptr TabCompletionModel::buildCommandSource() diff --git a/src/controllers/completion/TabCompletionModel.hpp b/src/controllers/completion/TabCompletionModel.hpp index 84a0753d6..f274a9944 100644 --- a/src/controllers/completion/TabCompletionModel.hpp +++ b/src/controllers/completion/TabCompletionModel.hpp @@ -31,10 +31,15 @@ public: private: enum class SourceKind { + // Known to be an emote, i.e. started with : Emote, + // Known to be a username, i.e. started with @ User, + // Known to be a command, i.e. started with / or . Command, + // Emote or command without : or / . EmoteCommand, + // Emote, user, or command without :, @, / . EmoteUserCommand }; @@ -54,7 +59,7 @@ private: std::unique_ptr buildSource(SourceKind kind) const; std::unique_ptr buildEmoteSource() const; - std::unique_ptr buildUserSource() const; + std::unique_ptr buildUserSource(bool prependAt) const; std::unique_ptr buildCommandSource() const; Channel &channel_;