Skip to content

Commit

Permalink
Fix issue #1050: The current pane switches without me asking it to.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdottaka committed Nov 14, 2021
1 parent 4fca713 commit d165aa7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Src/HexMergeDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,10 @@ void CHexMergeDoc::OnFileReload()
fileloc[pane].setPath(m_filePaths[pane]);
bRO[pane] = m_pView[pane]->GetReadOnly();
}
int nActivePane = GetActiveMergeView()->m_nThisPane;
if (!OpenDocs(m_nBuffers, fileloc, bRO, m_strDesc))
return;
MoveOnLoad(GetActiveMergeView()->m_nThisPane);
MoveOnLoad(nActivePane);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions Src/ImgMergeFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ void CImgMergeFrame::ChangeFile(int nBuffer, const String& path)
m_filePaths[nBuffer] = path;
m_nBufferType[nBuffer] = BUFFERTYPE::NORMAL;
m_strDesc[nBuffer] = _T("");
int nActivePane = m_pImgMergeWindow->GetActivePane();

OpenImages();
for (int pane = 0; pane < m_filePaths.GetSize(); ++pane)
Expand All @@ -292,6 +293,8 @@ void CImgMergeFrame::ChangeFile(int nBuffer, const String& path)
new DropHandler(std::bind(&CImgMergeFrame::OnDropFiles, this, pane, std::placeholders::_1)));
}

MoveOnLoad(nActivePane);

UpdateHeaderPath(nBuffer);
UpdateLastCompareResult();
}
Expand Down Expand Up @@ -883,7 +886,9 @@ void CImgMergeFrame::OnFileReload()
{
if (!PromptAndSaveIfNeeded(true))
return;
int nActivePane = m_pImgMergeWindow->GetActivePane();
OpenImages();
MoveOnLoad(nActivePane);
for (int pane = 0; pane < m_filePaths.GetSize(); ++pane)
m_fileInfo[pane].Update(m_filePaths[pane]);
}
Expand Down
6 changes: 4 additions & 2 deletions Src/MergeDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3346,12 +3346,13 @@ void CMergeDoc::ChangeFile(int nBuffer, const String& path, int nLineIndex)

bool filenameChanged = path != m_filePaths[nBuffer];
auto columnWidths = m_ptBuf[nBuffer]->GetColumnWidths();
int nActivePane = GetActiveMergeView()->m_nThisPane;

if (OpenDocs(m_nBuffers, fileloc, bRO, strDesc))
{
if (!filenameChanged)
m_ptBuf[nBuffer]->SetColumnWidths(columnWidths);
MoveOnLoad(nBuffer, nLineIndex);
MoveOnLoad(nActivePane, nLineIndex);
}
}

Expand Down Expand Up @@ -3578,12 +3579,13 @@ void CMergeDoc::OnFileReload()
fileloc[pane].encoding.m_codepage = m_ptBuf[pane]->getCodepage();
fileloc[pane].setPath(m_filePaths[pane]);
}
int nActivePane = GetActiveMergeView()->m_nThisPane;
CPoint pt = GetActiveMergeView()->GetCursorPos();
auto columnWidths = m_ptBuf[0]->GetColumnWidths();
if (OpenDocs(m_nBuffers, fileloc, bRO, m_strDesc))
{
m_ptBuf[0]->SetColumnWidths(columnWidths);
MoveOnLoad(GetActiveMergeView()->m_nThisPane, pt.y);
MoveOnLoad(nActivePane, pt.y);
}
}

Expand Down

0 comments on commit d165aa7

Please sign in to comment.