Skip to content

Commit

Permalink
WIP: adjust_hpos_shift works
Browse files Browse the repository at this point in the history
  • Loading branch information
MKadaner committed Jan 28, 2024
1 parent ff35ff4 commit b917db9
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions far/vmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,35 +407,31 @@ namespace

if (Shift < 0)
{
if (Right <= 0) return 0;
const auto NegativeLeftShiftLimit{ 1 - Right };
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)
{
if (TextAreaWidth <= Left) return 0;
const auto PositiveRightShiftLimit{ TextAreaWidth - Left - 1 };
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;
// if (Left >= TextAreaWidth)
// return std::max(Shift - (Left - TextAreaWidth), 1 - Right);
// return std::max(Shift, 1 - Right);
// 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 (Right <= 0)
// return std::min(Shift - Right, TextAreaWidth - Left - 1);
// if (Left >= TextAreaWidth)
// return 0;
// return std::min(Shift, TextAreaWidth - Left - 1);
// 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;
}
Expand Down

0 comments on commit b917db9

Please sign in to comment.