Skip to content

Commit

Permalink
change: prefer minwidth / minheigth to window size
Browse files Browse the repository at this point in the history
  • Loading branch information
amedama41 committed Oct 28, 2023
1 parent 1b594d5 commit 4520936
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lua/vfiler/libs/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ M.math = {}

-- Within the max and min between
function M.math.within(v, min, max)
return math.min(math.max(v, min), max)
return math.max(math.min(v, max), min)
end

--- Returns "integer" if the argument is an integer,
Expand Down
2 changes: 2 additions & 0 deletions tests/vfiler/libs/core_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ describe('core.math', function()
{ v = 10, min = 5, max = 20, expected = 10 },
{ v = 4, min = 5, max = 20, expected = 5 },
{ v = 21, min = 5, max = 20, expected = 20 },
{ v = 10, min = 20, max = 5, expected = 20 },
{ v = 21, min = 20, max = 5, expected = 20 },
{ v = -4, min = -5, max = 20, expected = -4 },
{ v = -6, min = -5, max = 20, expected = -5 },
{ v = -6, min = -8, max = -5, expected = -6 },
Expand Down

0 comments on commit 4520936

Please sign in to comment.