Skip to content

Commit

Permalink
WIP: adjust_hpos_shift and test finalized.
Browse files Browse the repository at this point in the history
  • Loading branch information
MKadaner committed Jan 28, 2024
1 parent 5b3be9a commit 9e85081
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions far/vmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,42 +409,12 @@ namespace

if (Shift > 0)
{
const auto RightShiftLimit{ std::max(TextAreaWidth - Left - 1, 0) };
const auto ShiftLimit{ std::max(TextAreaWidth - Left - 1, 0) };
const auto GapLeftOfTextArea{ std::max(-Right, 0) };
return std::min(Shift + GapLeftOfTextArea, RightShiftLimit);
return std::min(Shift + GapLeftOfTextArea, ShiftLimit);
}

return -adjust_hpos_shift(-Shift, TextAreaWidth - Right, TextAreaWidth - Left, TextAreaWidth);

//if (Shift < 0)
//{
// const auto NegativeLeftShiftLimit{ std::min(1 - Right, 0) };
// const auto PositiveGapRightOfTextArea{ std::max(Left - TextAreaWidth, 0) };
// return std::max(Shift - PositiveGapRightOfTextArea, NegativeLeftShiftLimit);
//}
//if (Shift > 0)
//{
// const auto PositiveRightShiftLimit{ std::max(TextAreaWidth - Left - 1, 0) };
// const auto NegativeGapLeftOfTextArea{ std::min(Right, 0) };
// return std::min(Shift - NegativeGapLeftOfTextArea, PositiveRightShiftLimit);
//}
//return 0;

//if (Shift < 0)
//{
// if (Right <= 0) return 0;
// const auto NegativeLeftShiftLimit{ 1 - Right };
// const auto PositiveGapRightOfTextArea{ std::max(Left - TextAreaWidth, 0) };
// return std::max(Shift - PositiveGapRightOfTextArea, NegativeLeftShiftLimit);
//}
//if (Shift > 0)
//{
// if (TextAreaWidth <= Left) return 0;
// const auto PositiveRightShiftLimit{ TextAreaWidth - Left - 1 };
// const auto NegativeGapLeftOfTextArea{ std::min(Right, 0) };
// return std::min(Shift - NegativeGapLeftOfTextArea, PositiveRightShiftLimit);
//}
//return 0;
}

int adjust_en_bloc_shift(const int Shift, const int EnBlocHScrollDiscriminator, const int TextAreaWidth)
Expand Down Expand Up @@ -3795,8 +3765,6 @@ TEST_CASE("adjust.hpos.shift")
REQUIRE(TestDataPoint.Expected[I] == adjust_hpos_shift(Shifts[I], TestDataPoint.Left, TestDataPoint.Right, TextAreaWidth));
}
}

// adjust_hpos_shift
}

TEST_CASE("adjust.en.bloc.shift")
Expand Down

0 comments on commit 9e85081

Please sign in to comment.