summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/source/control/field.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index c475bd250d09..174918035b25 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -707,9 +707,11 @@ void NumericFormatter::ImplNewFieldValue( sal_Int64 nNewValue )
sal_Int64 NumericFormatter::ClipAgainstMinMax(sal_Int64 nValue) const
{
if (nValue > mnMax)
- nValue = mbWrapOnLimits ? mnMin : mnMax;
+ nValue = mbWrapOnLimits ? ((nValue - mnMin) % (mnMax + 1)) + mnMin
+ : mnMax;
else if (nValue < mnMin)
- nValue = mbWrapOnLimits ? mnMax : mnMin;
+ nValue = mbWrapOnLimits ? ((nValue + mnMax + 1 - mnMin) % (mnMax + 1)) + mnMin
+ : mnMin;
return nValue;
}