From d864cdeb193dbd1209be92e6dbae2755602882ce Mon Sep 17 00:00:00 2001 From: gwigz Date: Fri, 26 Jun 2026 13:04:49 +0100 Subject: Address post-merge feedback for gesture autocomplete --- indra/llui/llgestureautocompletehelper.cpp | 3 --- indra/llui/llgestureautocompletehelper.h | 3 --- .../newview/llfloatergestureautocompletepicker.cpp | 11 ----------- indra/newview/llfloaterimnearbychat.cpp | 23 ++++++++-------------- 4 files changed, 8 insertions(+), 32 deletions(-) diff --git a/indra/llui/llgestureautocompletehelper.cpp b/indra/llui/llgestureautocompletehelper.cpp index ca976fff10..f00f1406e5 100644 --- a/indra/llui/llgestureautocompletehelper.cpp +++ b/indra/llui/llgestureautocompletehelper.cpp @@ -43,7 +43,6 @@ void LLGestureAutocompleteHelper::showHelper( LLUICtrl* host_ctrl, const std::vector& rows, size_t total, - const std::string& empty_text, std::function commit_cb) { if (mHelperHandle.isDead()) @@ -57,7 +56,6 @@ void LLGestureAutocompleteHelper::showHelper( setHostCtrl(host_ctrl); mRows = rows; mTotal = total; - mEmptyText = empty_text; mGestureCommitCb = commit_cb; S32 floater_x, floater_y; @@ -135,7 +133,6 @@ void LLGestureAutocompleteHelper::setHostCtrl(LLUICtrl* host_ctrl) mHostHandle.markDead(); mGestureCommitCb = {}; mRows.clear(); - mEmptyText.clear(); mTotal = 0; if (!mHelperHandle.isDead()) diff --git a/indra/llui/llgestureautocompletehelper.h b/indra/llui/llgestureautocompletehelper.h index 53000c0829..6292655fc7 100644 --- a/indra/llui/llgestureautocompletehelper.h +++ b/indra/llui/llgestureautocompletehelper.h @@ -54,7 +54,6 @@ public: LLUICtrl* host_ctrl, const std::vector& rows, size_t total, - const std::string& empty_text, std::function commit_cb); void hideHelper(const LLUICtrl* ctrl = nullptr); bool handleKey(const LLUICtrl* ctrl, KEY key, MASK mask); @@ -62,7 +61,6 @@ public: const std::vector& rows() const { return mRows; } size_t total() const { return mTotal; } - const std::string& emptyText() const { return mEmptyText; } protected: void setHostCtrl(LLUICtrl* host_ctrl); @@ -78,6 +76,5 @@ private: std::function mGestureCommitCb; std::vector mRows; - std::string mEmptyText; size_t mTotal = 0; }; diff --git a/indra/newview/llfloatergestureautocompletepicker.cpp b/indra/newview/llfloatergestureautocompletepicker.cpp index 14d2065b5b..c7c4e46459 100644 --- a/indra/newview/llfloatergestureautocompletepicker.cpp +++ b/indra/newview/llfloatergestureautocompletepicker.cpp @@ -66,17 +66,6 @@ void LLFloaterGestureAutocompletePicker::onOpen(const LLSD& key) mGestureList->addElement(element); } - if (rows.empty() && !helper.emptyText().empty()) - { - LLSD element; - element["enabled"] = false; - element["columns"][0]["column"] = "trigger"; - element["columns"][0]["value"] = helper.emptyText(); - element["columns"][1]["column"] = "name"; - element["columns"][1]["value"] = LLStringUtil::null; - mGestureList->addElement(element); - } - if (helper.total() > rows.size()) { LLSD element; diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index 8fa183b180..860535a28f 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -87,12 +87,10 @@ namespace bool buildGestureAutocompleteRows( const std::string& prefix, std::vector& rows, - size_t& total, - std::string& empty_text) + size_t& total) { rows.clear(); total = 0; - empty_text.clear(); // Wait for at least one character after the slash before offering matches. if (prefix.size() < 2 || prefix[0] != '/' || prefix.find_first_of(" \t") != std::string::npos) @@ -128,21 +126,18 @@ bool buildGestureAutocompleteRows( gesture->mName); } - for (const auto& gesture : unique) + for (const auto& [trigger, name] : unique) { - ++total; - - if (rows.size() < MAX_GESTURE_AUTOCOMPLETE_ROWS) + if (rows.size() >= MAX_GESTURE_AUTOCOMPLETE_ROWS) { - rows.push_back({ gesture.first, gesture.first, gesture.second }); + break; } - } - if (rows.empty()) - { - empty_text = "No matching gestures"; + rows.push_back({ trigger, trigger, name }); } + total = unique.size(); + return total > 0; } } @@ -576,16 +571,14 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke() { std::vector rows; size_t total = 0; - std::string empty_text; const std::string utf8_trigger = wstring_to_utf8str(raw_text); - if (buildGestureAutocompleteRows(utf8_trigger, rows, total, empty_text)) + if (buildGestureAutocompleteRows(utf8_trigger, rows, total)) { LLGestureAutocompleteHelper::instance().showHelper( mInputEditor, rows, total, - empty_text, [this](std::string trigger) { mInputEditor->setText(trigger + " "); -- cgit v1.3