Try to show some search results, if no space for full data.

This commit is contained in:
Bartosz Taudul
2026-01-25 02:07:25 +01:00
parent 7a2aaa6e8e
commit 1f4b2dd45f
+8 -1
View File
@@ -890,7 +890,14 @@ std::string TracyLlmTools::SourceSearch( std::string query, bool caseInsensitive
if( total == 0 ) return "No matches found.";
auto ret = json.dump( 2, ' ', false, nlohmann::json::error_handler_t::replace );
if( ret.size() > CalcMaxSize() ) return "Too many matches found.";
if( json.size() > 1 && ret.size() > CalcMaxSize() )
{
for( auto& item : json ) item.erase( "matches" );
json["hint"] = "Too many matches found to show all data. Narrow down the search to get line numbers.";
ret = json.dump( 2, ' ', false, nlohmann::json::error_handler_t::replace );
if( ret.size() > CalcMaxSize() ) return "Too many matches found.";
}
return ret;
}