Skip to content

Commit

Permalink
Fix issue #2514: Bug Report: Display Issues When Resizing WinMerge Ac…
Browse files Browse the repository at this point in the history
…ross Dual Monitors
  • Loading branch information
sdottaka committed Nov 3, 2024
1 parent d4ece2b commit 5574efa
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 27 deletions.
4 changes: 2 additions & 2 deletions Src/HexMergeFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ void CHexMergeFrame::UpdateHeaderSizes()
}
}

if (!std::equal(m_nLastSplitPos, m_nLastSplitPos + nPaneCount - 1, w))
if (!std::equal(m_nLastSplitPos, m_nLastSplitPos + nPaneCount, w))
{
std::copy_n(w, nPaneCount - 1, m_nLastSplitPos);
std::copy_n(w, nPaneCount, m_nLastSplitPos);

// resize controls in header dialog bar
m_wndFilePathBar.Resize(w);
Expand Down
4 changes: 2 additions & 2 deletions Src/ImgMergeFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,9 +1119,9 @@ void CImgMergeFrame::UpdateHeaderSizes()
w[pane] = (rcMergeWindow.Width() - scrollbarWidth) / nPaneCount - 6;
}

if (!std::equal(m_nLastSplitPos, m_nLastSplitPos + nPaneCount - 1, w))
if (!std::equal(m_nLastSplitPos, m_nLastSplitPos + nPaneCount, w))
{
std::copy_n(w, nPaneCount - 1, m_nLastSplitPos);
std::copy_n(w, nPaneCount, m_nLastSplitPos);

// resize controls in header dialog bar
m_wndFilePathBar.Resize(w);
Expand Down
4 changes: 2 additions & 2 deletions Src/MergeEditFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ void CMergeEditFrame::UpdateHeaderSizes()
w[pane] = (w2 - 4 * pDoc->m_nBuffers) / pDoc->m_nBuffers;
}

if (!std::equal(m_nLastSplitPos, m_nLastSplitPos + pDoc->m_nBuffers - 1, w))
if (!std::equal(m_nLastSplitPos, m_nLastSplitPos + pDoc->m_nBuffers, w))
{
std::copy_n(w, pDoc->m_nBuffers - 1, m_nLastSplitPos);
std::copy_n(w, pDoc->m_nBuffers, m_nLastSplitPos);

// resize controls in header dialog bar
m_wndFilePathBar.Resize(w);
Expand Down
24 changes: 6 additions & 18 deletions Src/MergeEditView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3836,25 +3836,13 @@ void CMergeEditView::OnSize(UINT nType, int cx, int cy)
return;

CMergeDoc * pDoc = GetDocument();
if (m_nThisPane < pDoc->m_nBuffers - 1)
{
// To calculate subline index correctly
// we have to invalidate line cache in all pane before calling the function related the subline.
for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++)
{
CMergeEditView *pView = GetGroupView(nPane);
if (pView != nullptr)
pView->InvalidateScreenRect(false);
}
}
else
// To calculate subline index correctly
// we have to invalidate line cache in all pane before calling the function related the subline.
for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++)
{
for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++)
{
CMergeEditView *pView = GetGroupView(nPane);
if (pView != nullptr)
pView->Invalidate();
}
CMergeEditView *pView = GetGroupView(nPane);
if (pView != nullptr)
pView->InvalidateScreenRect(false);
}
// recalculate m_nTopSubLine
m_nTopSubLine = GetSubLineIndex(m_nTopLine);
Expand Down
2 changes: 1 addition & 1 deletion Src/MergeFrameCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CMergeFrameCommon: public CMDIChildWnd
return TRUE; // https://stackoverflow.com/questions/35553955/getting-rid-of-3d-look-of-mdi-frame-window
}
protected:
int m_nLastSplitPos[2];
int m_nLastSplitPos[3];
private:
bool m_bActivated;
HICON m_hCurrent;
Expand Down
4 changes: 2 additions & 2 deletions Src/WebPageDiffFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,9 +832,9 @@ void CWebPageDiffFrame::UpdateHeaderSizes()
w[pane] = rcMergeWindow.Width() / nPaneCount - 4;
}

if (!std::equal(m_nLastSplitPos, m_nLastSplitPos + nPaneCount - 1, w))
if (!std::equal(m_nLastSplitPos, m_nLastSplitPos + nPaneCount, w))
{
std::copy_n(w, nPaneCount - 1, m_nLastSplitPos);
std::copy_n(w, nPaneCount, m_nLastSplitPos);

// resize controls in header dialog bar
m_wndFilePathBar.Resize(w);
Expand Down

0 comments on commit 5574efa

Please sign in to comment.