Index: src/TortoiseMerge/BaseView.cpp =================================================================== --- src/TortoiseMerge/BaseView.cpp (revision 21083) +++ src/TortoiseMerge/BaseView.cpp (working copy) @@ -1981,9 +1981,8 @@ return (((point.y - HEADERHEIGHT) / GetLineHeight()) + m_nTopLine); } -bool CBaseView::OnContextMenu(CPoint /*point*/, int /*nLine*/, DiffStates /*state*/) +void CBaseView::OnContextMenu(CPoint /*point*/, int /*nLine*/, DiffStates /*state*/) { - return false; } void CBaseView::OnContextMenu(CWnd* /*pWnd*/, CPoint point) @@ -2006,12 +2005,10 @@ int nIndex = viewLine; int nLineIndex = nLine - 1; DiffStates state = m_pViewData->GetState(nIndex); - // select the diff block under the cursor. - if (((m_nSelBlockStart<0)&&(m_nSelBlockEnd<0))|| - ((m_nSelBlockEnd < m_nTopLine)||(m_nSelBlockStart > m_nTopLine+m_nScreenLines))|| - ((m_nSelBlockEnd > nLineIndex)||(m_nSelBlockStart < nLineIndex)) - ) + // If cursor is not over selection, select the diff block under the cursor. + if ((m_nSelBlockEnd < nLineIndex)||(m_nSelBlockStart > nLineIndex)) { + ClearSelection(); // Clear text-copy selection while (nIndex >= 0) { if (nIndex == 0) @@ -2055,9 +2052,7 @@ break; } } - bool bKeepSelection = OnContextMenu(point, nLine, state); - if (! bKeepSelection) - ClearSelection(); + OnContextMenu(point, nLine, state); RefreshViews(); } } Index: src/TortoiseMerge/BaseView.h =================================================================== --- src/TortoiseMerge/BaseView.h (revision 21083) +++ src/TortoiseMerge/BaseView.h (working copy) @@ -229,8 +229,7 @@ static void GetWhitespaceBlock(CViewData *viewData, int nLineIndex, int & nStartBlock, int & nEndBlock); static CString GetWhitespaceString(CViewData *viewData, int nStartBlock, int nEndBlock); - /// Returns true if selection should be kept - virtual bool OnContextMenu(CPoint point, int nLine, DiffStates state); + virtual void OnContextMenu(CPoint point, int nLine, DiffStates state); /** * Updates the status bar pane. Call this if the document changed. */ Index: src/TortoiseMerge/BottomView.cpp =================================================================== --- src/TortoiseMerge/BottomView.cpp (revision 21083) +++ src/TortoiseMerge/BottomView.cpp (working copy) @@ -33,14 +33,14 @@ { } -bool CBottomView::OnContextMenu(CPoint point, int /*nLine*/, DiffStates state) +void CBottomView::OnContextMenu(CPoint point, int /*nLine*/, DiffStates state) { if (!this->IsWindowVisible()) - return false; + return; CMenu popup; if (!popup.CreatePopupMenu()) - return false; + return; #define ID_USETHEIRBLOCK 1 #define ID_USEYOURBLOCK 2 @@ -84,7 +84,7 @@ break; case ID_EDIT_COPY: OnEditCopy(); - return true; + return; case ID_EDIT_CUT: OnEditCopy(); RemoveSelectedText(); @@ -93,7 +93,7 @@ PasteText(); break; } - return false; + return; } void CBottomView::UseTheirTextBlock() Index: src/TortoiseMerge/BottomView.h =================================================================== --- src/TortoiseMerge/BottomView.h (revision 21083) +++ src/TortoiseMerge/BottomView.h (working copy) @@ -36,6 +36,6 @@ void UseTheirThenMyTextBlock(); protected: - bool OnContextMenu(CPoint point, int nLine, DiffStates state); + void OnContextMenu(CPoint point, int nLine, DiffStates state); }; Index: src/TortoiseMerge/LeftView.cpp =================================================================== --- src/TortoiseMerge/LeftView.cpp (revision 21083) +++ src/TortoiseMerge/LeftView.cpp (working copy) @@ -33,14 +33,14 @@ { } -bool CLeftView::OnContextMenu(CPoint point, int /*nLine*/, DiffStates state) +void CLeftView::OnContextMenu(CPoint point, int /*nLine*/, DiffStates state) { if (!m_pwndRight->IsWindowVisible()) - return false; + return; CMenu popup; if (!popup.CreatePopupMenu()) - return false; + return; #define ID_USEBLOCK 1 #define ID_USEFILE 2 @@ -86,14 +86,14 @@ { case ID_EDIT_COPY: OnEditCopy(); - return true; + return; case ID_EDIT_CUT: OnEditCopy(); RemoveSelectedText(); - return false; + return; case ID_EDIT_PASTE: PasteText(); - return false; + return; case ID_USEFILE: if (m_pwndBottom->IsWindowVisible()) { @@ -239,8 +239,8 @@ UseBothLeftFirst(rightstate, leftstate); break; default: - return false; + return; } // switch (cmd) CUndo::GetInstance().AddState(leftstate, rightstate, bottomstate, m_ptCaretPos); - return false; + return; } Index: src/TortoiseMerge/LeftView.h =================================================================== --- src/TortoiseMerge/LeftView.h (revision 21083) +++ src/TortoiseMerge/LeftView.h (working copy) @@ -30,6 +30,6 @@ CLeftView(void); ~CLeftView(void); protected: - bool OnContextMenu(CPoint point, int nLine, DiffStates state); + void OnContextMenu(CPoint point, int nLine, DiffStates state); }; Index: src/TortoiseMerge/RightView.cpp =================================================================== --- src/TortoiseMerge/RightView.cpp (revision 21083) +++ src/TortoiseMerge/RightView.cpp (working copy) @@ -33,14 +33,14 @@ { } -bool CRightView::OnContextMenu(CPoint point, int /*nLine*/, DiffStates state) +void CRightView::OnContextMenu(CPoint point, int /*nLine*/, DiffStates state) { if (!this->IsWindowVisible()) - return false; + return; CMenu popup; if (!popup.CreatePopupMenu()) - return false; + return; #define ID_USEBLOCK 1 #define ID_USEFILE 2 @@ -96,14 +96,14 @@ { case ID_EDIT_COPY: OnEditCopy(); - return true; + return; case ID_EDIT_CUT: OnEditCopy(); RemoveSelectedText(); - return false; + return; case ID_EDIT_PASTE: PasteText(); - return false; + return; case ID_USEFILE: UseFile(false); break; @@ -127,9 +127,9 @@ CUndo::GetInstance().AddState(leftstate, rightstate, bottomstate, m_ptCaretPos); break; default: - return false; + return; } // switch (cmd) - return false; + return; } void CRightView::UseFile(bool refreshViews /* = true */) Index: src/TortoiseMerge/RightView.h =================================================================== --- src/TortoiseMerge/RightView.h (revision 21083) +++ src/TortoiseMerge/RightView.h (working copy) @@ -36,6 +36,6 @@ void UseLeftBeforeRight(bool refreshViews = true); void UseRightBeforeLeft(bool refreshViews = true); protected: - bool OnContextMenu(CPoint point, int nLine, DiffStates state); + void OnContextMenu(CPoint point, int nLine, DiffStates state); };