@@ -466,6 +466,17 @@ namespace gitReview
466466 }
467467 }
468468
469+ void drawFixedDiffLineNumberGutter (ImDrawList *dl, const ImVec2 &contentTopLeft, float gutterW, float paneH, float lineH, float padY,
470+ int rowBegin, int rowEnd, const std::vector<int > &nums, ImU32 textCol, ImU32 ruleCol)
471+ {
472+ const ImRect clipR (ImGui::GetCurrentWindow ()->InnerClipRect );
473+ const ImVec2 fixedTopLeft (clipR.Min .x , contentTopLeft.y );
474+ const ImU32 bgCol = ImGui::GetColorU32 (ImGuiCol_WindowBg);
475+ dl->AddRectFilled (fixedTopLeft, ImVec2 (fixedTopLeft.x + gutterW, fixedTopLeft.y + paneH), bgCol);
476+ drawDiffLineNumberGutter (dl, fixedTopLeft, gutterW, lineH, padY, rowBegin, rowEnd, nums, textCol);
477+ dl->AddLine (ImVec2 (fixedTopLeft.x + gutterW, fixedTopLeft.y ), ImVec2 (fixedTopLeft.x + gutterW, fixedTopLeft.y + paneH), ruleCol, 1 .f );
478+ }
479+
469480 static std::vector<std::string> untrackedPathsToIgnoreFromSelection (const ReviewAppState &app)
470481 {
471482 std::vector<std::string> out;
@@ -1619,10 +1630,8 @@ namespace gitReview
16191630 {
16201631 drawMergePaneBackground (dll, ImVec2 (innerL.x + gutterW, innerL.y ), innerWL, lineH, padXL, padYL, clipBg.DisplayStart , clipBg.DisplayEnd ,
16211632 rows, app.cachedMergeConflictLineRanges , branchDiffCol, conflictCol);
1622- drawDiffLineNumberGutter (dll, innerL, gutterW, lineH, padYL, clipBg.DisplayStart , clipBg.DisplayEnd , gutNums, gutterTextCol);
16231633 }
16241634
1625- dll->AddLine (ImVec2 (innerL.x + gutterW, innerL.y ), ImVec2 (innerL.x + gutterW, innerL.y + paneH), gutterRuleCol, 1 .f );
16261635 ImGui::SetCursorPos (ImVec2 (gutterW, 0 .f ));
16271636
16281637 if (buf.empty ())
@@ -1680,6 +1689,14 @@ namespace gitReview
16801689 }
16811690 }
16821691 }
1692+ ImGui::SetCursorPos (ImVec2 (0 .f , 0 .f ));
1693+ ImGuiListClipper clipGut;
1694+ clipGut.Begin (static_cast <int >(rows.size ()), lineH);
1695+ while (clipGut.Step ())
1696+ {
1697+ drawFixedDiffLineNumberGutter (dll, innerL, gutterW, paneH, lineH, padYL, clipGut.DisplayStart , clipGut.DisplayEnd , gutNums,
1698+ gutterTextCol, gutterRuleCol);
1699+ }
16831700 ImGui::EndChild ();
16841701 };
16851702
@@ -2027,14 +2044,10 @@ namespace gitReview
20272044 clipperLeftHL.Begin (static_cast <int >(rows.size ()), lineH);
20282045 while (clipperLeftHL.Step ())
20292046 {
2030- drawDiffLineNumberGutter (dll, innerL, gutterW, lineH, padYL, clipperLeftHL.DisplayStart , clipperLeftHL.DisplayEnd , leftLineNums,
2031- gutterTextCol);
20322047 drawLeftPaneHighlights (dll, ImVec2 (innerL.x + gutterW, innerL.y ), innerWL, lineH, padXL, padYL, clipperLeftHL.DisplayStart ,
20332048 clipperLeftHL.DisplayEnd , rows, largeFB, delc, muted);
20342049 }
20352050
2036- dll->AddLine (ImVec2 (innerL.x + gutterW, innerL.y ), ImVec2 (innerL.x + gutterW, innerL.y + paneH), gutterRuleCol, 1 .f );
2037-
20382051 ImGui::SetCursorPos (ImVec2 (gutterW, 0 .f ));
20392052
20402053 std::vector<char > &leftBuf = app.leftViewBuffer ;
@@ -2080,6 +2093,14 @@ namespace gitReview
20802093 }
20812094 }
20822095 }
2096+ ImGui::SetCursorPos (ImVec2 (0 .f , 0 .f ));
2097+ ImGuiListClipper clipperLeftGut;
2098+ clipperLeftGut.Begin (static_cast <int >(rows.size ()), lineH);
2099+ while (clipperLeftGut.Step ())
2100+ {
2101+ drawFixedDiffLineNumberGutter (dll, innerL, gutterW, paneH, lineH, padYL, clipperLeftGut.DisplayStart , clipperLeftGut.DisplayEnd ,
2102+ leftLineNums, gutterTextCol, gutterRuleCol);
2103+ }
20832104 }
20842105 ImGui::EndChild ();
20852106
@@ -2099,13 +2120,10 @@ namespace gitReview
20992120 clipperHL.Begin (static_cast <int >(rows.size ()), lineH);
21002121 while (clipperHL.Step ())
21012122 {
2102- drawDiffLineNumberGutter (dl, inner0, gutterW, lineH, padY, clipperHL.DisplayStart , clipperHL.DisplayEnd , rightLineNums, gutterTextCol);
21032123 drawRightPaneHighlights (dl, ImVec2 (inner0.x + gutterW, inner0.y ), textW, lineH, padX, padY, clipperHL.DisplayStart , clipperHL.DisplayEnd , rows,
21042124 largeFB, addc, chgcol, muted);
21052125 }
21062126
2107- dl->AddLine (ImVec2 (inner0.x + gutterW, inner0.y ), ImVec2 (inner0.x + gutterW, inner0.y + paneH), gutterRuleCol, 1 .f );
2108-
21092127 ImGui::SetCursorPos (ImVec2 (gutterW, 0 .f ));
21102128
21112129 ImGuiInputTextFlags editFlags = ImGuiInputTextFlags_CallbackResize;
@@ -2155,6 +2173,14 @@ namespace gitReview
21552173 }
21562174 }
21572175 }
2176+ ImGui::SetCursorPos (ImVec2 (0 .f , 0 .f ));
2177+ ImGuiListClipper clipperRightGut;
2178+ clipperRightGut.Begin (static_cast <int >(rows.size ()), lineH);
2179+ while (clipperRightGut.Step ())
2180+ {
2181+ drawFixedDiffLineNumberGutter (dl, inner0, gutterW, paneH, lineH, padY, clipperRightGut.DisplayStart , clipperRightGut.DisplayEnd ,
2182+ rightLineNums, gutterTextCol, gutterRuleCol);
2183+ }
21582184 }
21592185 ImGui::EndChild ();
21602186
0 commit comments