From 13ed9a0a3c68eb9604da5362f24a1869e90a180e Mon Sep 17 00:00:00 2001 From: lededev <30518126+lededev@users.noreply.github.com> Date: Sun, 3 Nov 2024 13:35:43 +0800 Subject: [PATCH] Adjust right-click deselect from down to up to preserve right-click + scroll functionality. (#2511) --- Src/MergeEditView.cpp | 14 +++++++++----- Src/MergeEditView.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Src/MergeEditView.cpp b/Src/MergeEditView.cpp index a8336a032a5..7803e93ef27 100644 --- a/Src/MergeEditView.cpp +++ b/Src/MergeEditView.cpp @@ -84,7 +84,7 @@ BEGIN_MESSAGE_MAP(CMergeEditView, CCrystalEditViewEx) ON_WM_TIMER() ON_WM_LBUTTONDBLCLK() ON_WM_LBUTTONUP() - ON_WM_RBUTTONDOWN() + ON_WM_RBUTTONUP() ON_WM_VSCROLL () ON_WM_HSCROLL () ON_WM_SIZE() @@ -1931,13 +1931,17 @@ void CMergeEditView::OnLButtonUp(UINT nFlags, CPoint point) /** * @brief Called when mouse right button is pressed. * - * If right button is pressed outside diffs, current diff + * If right button is pressed outside diffs, and it is not + * right button + wheel scrolling combination, current diff * is deselected. */ -void CMergeEditView::OnRButtonDown(UINT nFlags, CPoint point) +void CMergeEditView::OnRButtonUp(UINT nFlags, CPoint point) { - CCrystalEditViewEx::OnRButtonDown(nFlags, point); - DeselectDiffIfCursorNotInCurrentDiff(); + if (!CMouseHook::IsRightWheelScrolling()) + { + DeselectDiffIfCursorNotInCurrentDiff(); + } + CCrystalEditViewEx::OnRButtonUp(nFlags, point); } void CMergeEditView::OnX2Y(int srcPane, int dstPane, bool selectedLineOnly) diff --git a/Src/MergeEditView.h b/Src/MergeEditView.h index 6ecc30ebf00..b62f74dae15 100644 --- a/Src/MergeEditView.h +++ b/Src/MergeEditView.h @@ -239,7 +239,7 @@ class CMergeEditView : public CGhostTextView afx_msg void OnUpdatePrevdiffRO(CCmdUI* pCmdUI); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); - afx_msg void OnRButtonDown(UINT nFlags, CPoint point); + afx_msg void OnRButtonUp(UINT nFlags, CPoint point); afx_msg void OnAllLeft(); afx_msg void OnUpdateAllLeft(CCmdUI* pCmdUI); afx_msg void OnAllRight();