* @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? */
| 1072 | * @todo Parameter bSelectText is never used? |
| 1073 | */ |
| 1074 | void 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 | |
| 1095 | void CMergeEditView::DeselectDiffIfCursorNotInCurrentDiff() |
| 1096 | { |
no test coverage detected