diff options
| author | gwigz <gwigz@users.noreply.github.com> | 2026-06-26 13:04:49 +0100 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-06-26 20:58:37 +0300 |
| commit | d864cdeb193dbd1209be92e6dbae2755602882ce (patch) | |
| tree | 0f0b71f99769cd6f261510f4cc7875996911e797 | |
| parent | 14262bf5e91b801e64943470cdc62e586759d40f (diff) | |
Address post-merge feedback for gesture autocomplete
| -rw-r--r-- | indra/llui/llgestureautocompletehelper.cpp | 3 | ||||
| -rw-r--r-- | indra/llui/llgestureautocompletehelper.h | 3 | ||||
| -rw-r--r-- | indra/newview/llfloatergestureautocompletepicker.cpp | 11 | ||||
| -rw-r--r-- | 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<Row>& rows, size_t total, - const std::string& empty_text, std::function<void(std::string)> 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<Row>& rows, size_t total, - const std::string& empty_text, std::function<void(std::string)> 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<Row>& 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<void(std::string)> mGestureCommitCb; std::vector<Row> 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<LLGestureAutocompleteHelper::Row>& 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<LLGestureAutocompleteHelper::Row> 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 + " "); |
