MCPcopy Create free account
hub / github.com/WinMerge/winmerge / SelectDiff

Method SelectDiff

Src/MergeEditView.cpp:1074–1093  ·  view source on GitHub ↗

* @brief Selects diff by number and syncs other file * @param [in] nDiff Diff to select, must be >= 0 * @param [in] bScroll Scroll diff to view * @param [in] bSelectText Select diff text * @sa CMergeEditView::ShowDiff() * @sa CMergeDoc::SetCurrentDiff() * @todo Parameter bSelectText is never used? */

Source from the content-addressed store, hash-verified

1072 * @todo Parameter bSelectText is never used?
1073 */
1074void CMergeEditView::SelectDiff(int nDiff, bool bScroll /*= true*/, bool bSelectText /*= true*/)
1075{
1076 CMergeDoc *pd = GetDocument();
1077
1078 // Check that nDiff is valid
1079 if (nDiff < 0)
1080 _RPTF1(_CRT_ERROR, "Diffnumber negative (%d)", nDiff);
1081 if (nDiff >= pd->m_diffList.GetSize())
1082 _RPTF2(_CRT_ERROR, "Selected diff > diffcount (%d >= %d)",
1083 nDiff, pd->m_diffList.GetSize());
1084
1085 SelectNone();
1086 pd->SetCurrentDiff(nDiff);
1087 ShowDiff(bScroll, bSelectText);
1088 pd->UpdateAllViews(this);
1089 UpdateSiblingScrollPos(false);
1090
1091 // notify either side, as it will notify the other one
1092 pd->ForEachView ([&](auto& pView) { if (pView->m_bDetailView) pView->OnDisplayDiff(nDiff); });
1093}
1094
1095void CMergeEditView::DeselectDiffIfCursorNotInCurrentDiff()
1096{

Callers 4

DoAutoMergeMethod · 0.80
MoveOnLoadMethod · 0.80
OnWMGotoMethod · 0.80
MoveOnLoadMethod · 0.80

Calls 4

SetCurrentDiffMethod · 0.80
OnDisplayDiffMethod · 0.80
GetSizeMethod · 0.45
ForEachViewMethod · 0.45

Tested by

no test coverage detected