Build lists of unique source files in comparison menu.

This commit is contained in:
Bartosz Taudul 2022-12-23 17:11:47 +01:00
parent 886456ea44
commit bd06d4e104
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 40 additions and 0 deletions

View File

@ -741,6 +741,9 @@ private:
int64_t total[2];
int minBinVal = 1;
int compareMode = 0;
bool diffDone = false;
std::vector<const char*> thisUnique;
std::vector<const char*> secondUnique;
void ResetSelection()
{
@ -762,6 +765,9 @@ private:
match[i].clear();
selMatch[i] = 0;
}
diffDone = false;
thisUnique.clear();
secondUnique.clear();
}
} m_compare;

View File

@ -254,6 +254,40 @@ void View::DrawCompare()
{
ImGui::Separator();
ImGui::BeginChild( "##compare" );
if( !m_compare.diffDone )
{
m_compare.diffDone = true;
const auto& tfc = m_worker.GetSourceFileCache();
const auto& ofc = m_compare.second->GetSourceFileCache();
if( !tfc.empty() && !ofc.empty() )
{
for( auto& tv : tfc )
{
auto it = ofc.find( tv.first );
if( it == ofc.end() )
{
m_compare.thisUnique.emplace_back( tv.first );
}
else if( tv.second.len != it->second.len || memcmp( tv.second.data, it->second.data, tv.second.len ) != 0 )
{
}
}
for( auto& ov : ofc )
{
auto it = tfc.find( ov.first );
if( it == tfc.end() )
{
m_compare.secondUnique.emplace_back( ov.first );
}
}
std::sort( m_compare.thisUnique.begin(), m_compare.thisUnique.end(), []( const auto& lhs, const auto& rhs ) { return strcmp( lhs, rhs ) < 0; } );
std::sort( m_compare.secondUnique.begin(), m_compare.secondUnique.end(), []( const auto& lhs, const auto& rhs ) { return strcmp( lhs, rhs ) < 0; } );
}
}
}
else
{