Skip to content

Commit

Permalink
Fix issue #2543: The height of the lines connecting moving blocks in …
Browse files Browse the repository at this point in the history
…the location pane may be incorrect
  • Loading branch information
sdottaka committed Nov 17, 2024
1 parent af86e37 commit 4cd5fea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions Src/LocationView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ void CLocationView::CalculateBlocks()
CalculateBlocksPixel(
pView->GetSubLineIndex(bs[i]),
pView->GetSubLineIndex(bs[i + 1]),
pView->GetSubLines(bs[i + 1]), nBeginY, nEndY);
nBeginY, nEndY);

block.top_line = bs[i];
block.bottom_line = bs[i + 1];
block.bottom_line = bs[i + 1] - 1;
block.top_coord = nBeginY;
block.bottom_coord = nEndY;
block.diff_index = nDiff;
Expand All @@ -324,10 +324,10 @@ void CLocationView::CalculateBlocks()
*/
void CLocationView::CalculateBlocksPixel(int nBlockStart, int nBlockEnd,
int nBlockLength, int &nBeginY, int &nEndY)
int &nBeginY, int &nEndY)
{
// Count how many line does the diff block have.
const int nBlockHeight = nBlockEnd - nBlockStart + nBlockLength;
const int nBlockHeight = nBlockEnd - nBlockStart;

// Convert diff block size from lines to pixels.
nBeginY = (int)(nBlockStart * m_lineInPix + Y_OFFSET);
Expand Down Expand Up @@ -461,7 +461,7 @@ void CLocationView::OnDraw(CDC* pDC)
{
int apparent0 = (*iter).top_line;
int apparent1 = pDoc->RightLineInMovedBlock(pane, apparent0);
const int nBlockHeight = (*iter).bottom_line - (*iter).top_line + 1;
const int nBlockHeight = (*iter).bottom_coord - (*iter).top_coord;
if (apparent1 != -1)
{
MovedLine line;
Expand All @@ -472,9 +472,9 @@ void CLocationView::OnDraw(CDC* pDC)
apparent1 = pView->GetSubLineIndex(apparent1);

int leftUpper = (int) (apparent0 * m_lineInPix + Y_OFFSET);
int leftLower = (int) ((nBlockHeight + apparent0) * m_lineInPix + Y_OFFSET - 1);
int leftLower = leftUpper + nBlockHeight - 1;
int rightUpper = (int) (apparent1 * m_lineInPix + Y_OFFSET);
int rightLower = (int) ((nBlockHeight + apparent1) * m_lineInPix + Y_OFFSET - 1);
int rightLower = rightUpper + nBlockHeight - 1;
line.ptLeftUpper.x = line.ptLeftLower.x = m_bar[pane].right - 1;
line.ptLeftUpper.y = leftUpper;
line.ptLeftLower.y = leftLower;
Expand Down
2 changes: 1 addition & 1 deletion Src/LocationView.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class CLocationView : public CView
void DrawDiffMarker(CDC* pDC, int yCoord);
void CalculateBars();
void CalculateBlocks();
void CalculateBlocksPixel(int nBlockStart, int nBlockEnd, int nBlockLength,
void CalculateBlocksPixel(int nBlockStart, int nBlockEnd,
int &nBeginY, int &nEndY);
COLORREF GetBackgroundColor();
void DrawBackground(CDC* pDC);
Expand Down
1 change: 1 addition & 0 deletions Src/MergeEditView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4356,6 +4356,7 @@ void CMergeEditView::ZoomText(short amount)
}
}
}
RepaintLocationPane();

GetOptionsMgr()->SaveOption(OPT_VIEW_ZOOM, nPointSize * 1000 / nOrgPointSize);
}
Expand Down

0 comments on commit 4cd5fea

Please sign in to comment.