Skip to content

Commit

Permalink
Merge pull request #31 from amedama41/feature/prefer_minvalue
Browse files Browse the repository at this point in the history
change: prefer minwidth / minheigth to window size
  • Loading branch information
obaland authored Oct 29, 2023
2 parents b063df2 + 4520936 commit b8e9ec4
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 b8e9ec4

Please sign in to comment.