for (int file = 0; file < m_nBuffers; ++file)
{
const TCHAR *p = m_ptBuf[file]->GetLineChars(i);
- str[file] = p ? p : _T("");
+ str[file] = p ? String(p, m_ptBuf[file]->GetFullLineLength(i)) : _T("");
}
if (std::count(str + 1, str + m_nBuffers, str[0]) != m_nBuffers - 1)
m_diffWrapper.GetOptions(&diffOptions);
// Make the call to stringdiffs, which does all the hard & tedious computations
- std::vector<strdiff::wdiff> worddiffs = strdiff::ComputeWordDiffs(m_nBuffers, str,
+ int result = strdiff::Compare(str[0], str[1],
!diffOptions.bIgnoreCase,
!diffOptions.bIgnoreEol,
diffOptions.nIgnoreWhitespace,
- diffOptions.bIgnoreNumbers,
- GetBreakType(), // whitespace only or include punctuation
- GetByteColoringOption());
- if (!worddiffs.empty())
+ diffOptions.bIgnoreNumbers);
+ if (m_nBuffers >= 2 && result == 0)
+ {
+ result = strdiff::Compare(str[1], str[2],
+ !diffOptions.bIgnoreCase,
+ !diffOptions.bIgnoreEol,
+ diffOptions.nIgnoreWhitespace,
+ diffOptions.bIgnoreNumbers);
+ }
+ if (result != 0)
{
for (int file = 0; file < m_nBuffers; ++file)
m_ptBuf[file]->SetLineFlag(i, LF_TRIVIAL, true, false, false);
+ ++m_nTrivialDiffs;
}
}
}
if (nRescanResult != RESCAN_SUPPRESSED)
ShowRescanError(nRescanResult, identical);
m_LastRescan = COleDateTime::GetCurrentTime();
+ SetTitle(nullptr);
}
/**
{
PrediffingInfo infoPrediffer;
GetPrediffer(&infoPrediffer);
- String sTitle = (lpszTitle != nullptr) ? lpszTitle : CMergeFrameCommon::GetTitleString(m_filePaths, m_strDesc, &m_infoUnpacker, &infoPrediffer);
+ String sTitle = (lpszTitle != nullptr) ? lpszTitle : CMergeFrameCommon::GetTitleString(m_filePaths, m_strDesc, &m_infoUnpacker, &infoPrediffer, m_nTrivialDiffs > 0);
CDocument::SetTitle(sTitle.c_str());
}
SetPrediffer(&prediffer);
m_CurrentPredifferID = -1;
FlushAndRescan(true);
- SetTitle(nullptr);
}
/**
{
SetPredifferByMenu(nID);
FlushAndRescan(true);
- SetTitle(nullptr);
}
/**
}\r
\r
String CMergeFrameCommon::GetTitleString(const PathContext& paths, const String desc[],\r
- PackingInfo *pInfoUnpacker, PrediffingInfo *pInfoPrediffer)\r
+ PackingInfo *pInfoUnpacker, PrediffingInfo *pInfoPrediffer, bool hasTrivialDiffs)\r
{\r
const int nBuffers = paths.GetSize();\r
String sFileName[3];\r
sTitle = sFileName[0] + strutils::format(_T(" x %d"), nBuffers);\r
else\r
sTitle = strutils::join(&sFileName[0], &sFileName[0] + nBuffers, _T(" - "));\r
- String plugin;\r
+ String flags;\r
if (pInfoUnpacker && !pInfoUnpacker->GetPluginPipeline().empty())\r
- plugin += _T("U");\r
+ flags += _T("U");\r
if (pInfoPrediffer && !pInfoPrediffer->GetPluginPipeline().empty())\r
- plugin += _T("P");\r
- return sTitle + (plugin.empty() ? _T("") : (_T(" (") + plugin + _T(")")));\r
+ flags += _T("P");\r
+ if (hasTrivialDiffs)\r
+ flags += _T("F");\r
+ return sTitle + (flags.empty() ? _T("") : (_T(" (") + flags + _T(")")));\r
}\r
\r
void CMergeFrameCommon::OnGetMinMaxInfo(MINMAXINFO* lpMMI)\r
void ActivateFrame(int nCmdShow);\r
void SetLastCompareResult(int nResult);\r
static void ShowIdenticalMessage(const PathContext& paths, bool bIdenticalAll, std::function<int (LPCTSTR, UINT, UINT)> funcMessageBox);\r
- static String GetTitleString(const PathContext& paths, const String desc[], PackingInfo *pInfoUnpacker, PrediffingInfo *pInfoPrediffer);\r
+ static String GetTitleString(const PathContext& paths, const String desc[], PackingInfo *pInfoUnpacker, PrediffingInfo *pInfoPrediffer, bool hasTrivialDiffs = false);\r
void SaveWindowState();\r
void SetSharedMenu(HMENU hMenu) { m_hMenuShared = hMenu; }\r
void RemoveBarBorder();\r