From 981c180d5ca245505629d52185a57fc28a80f268 Mon Sep 17 00:00:00 2001 From: Daniel Sage Date: Sat, 30 Sep 2023 19:25:58 -0400 Subject: [PATCH 1/2] Fix username tab completion without @ --- src/controllers/completion/TabCompletionModel.cpp | 11 +++++++---- src/controllers/completion/TabCompletionModel.hpp | 7 ++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/controllers/completion/TabCompletionModel.cpp b/src/controllers/completion/TabCompletionModel.cpp index 3d8afd36e52..a56ea1a5900 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 84a0753d603..f274a99449f 100644 --- a/src/controllers/completion/TabCompletionModel.hpp +++ b/src/controllers/completion/TabCompletionModel.hpp @@ -31,10 +31,15 @@ class TabCompletionModel : public QStringListModel 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 @@ class TabCompletionModel : public QStringListModel 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_; From 80a78941afc906c0177a52fcb617ee59dfce3a94 Mon Sep 17 00:00:00 2001 From: Daniel Sage Date: Sat, 30 Sep 2023 19:28:56 -0400 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4143892acd7..480ae211599 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,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) ## 2.4.5